python-algorithm

백준 13234 George Boole

무적김두칠 2022. 12. 5. 18:59

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

반응형