본문 바로가기
프로그램

[파이썬] 문제 : True, False의 and, or, not

by 오디세이99 2023. 2. 20.
728x90
반응형

print(True and True)

- and 는 두 조건 모두 True여야 결과가 True가 됩니다.

print(False or True)

- or 조건 입니다. 둘 중 하나라도 참(True)면 결과를 True 가 됩니다.

print(not True)

- 앞에 not이 붙으면 반대가 됩니다. 여기서는 True의 반대, 즉 False 됩니다.

print(not True and False or not False)

-하나씩 분리해서 보면

- not True = False

- False or not False 에서 not False 는 True로 해서 False or True이니 or 조건 즉 둘 중 하나라도 True이면 True가 되죠.

 

728x90
반응형

댓글