본문 바로가기
python-algorithm

백준 26560 Periods

by 무적김두칠 2023. 1. 24.

https://www.acmicpc.net/problem/26560

 

26560번: Periods

Eric gets distracted so sometimes he forgets to put periods at the end of his sentences. To help him out, you are to put a period at the end of his sentences if the period is not already present.

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
def sol(s):
    if s[-1!= '.':
        return s + '.'
    else:
        return s
 
 
if __name__ == '__main__':
    n = int(input())
    for _ in range(n):
        s = input()
        print(sol(s))
 
cs
반응형

댓글