본문 바로가기
python-algorithm

백준 13234 George Boole

by 무적김두칠 2022. 12. 5.

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

 

13234번: George Boole

George Boole was an English mathematician, educator, philosopher who was born in 1815, 200 years ago. He was the first professor of mathematics at Queen's College, Cork (now University College Cork (UCC)) and is known as the inventor of boolean arithmetic:

www.acmicpc.net

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def sol(s):
    s = list(s.split())
    s[0]=s[0].capitalize()
    s[1= s[1].lower()
    s[2= s[2].capitalize()
    if eval(s[0]+' ' + s[1]+' ' + s[2]):
        return 'true'
    else:
        return 'false'
    return
if __name__ == '__main__':
    s = input()
    print(sol(s))
 
cs

문자열은 할당이 되지 않아 list로 변환후 eval 함수 사용
String cannot be assigned , So type should be changed to list, and use eval function

반응형

'python-algorithm' 카테고리의 다른 글

백준 7120 String  (0) 2022.12.05
백준 6438 Reverse Text  (1) 2022.12.05
백준 15080 Every Second Counts  (0) 2022.12.04
백준 26209 Intercepting Information  (0) 2022.12.04
백준 14625 냉동식품  (0) 2022.12.03

댓글