-
list에서 in 연산자를 사용하면 값이 있으면 true 없으면 false 가 나온다.
string에서는 한글자씩 비교하면서 일치하는 값이 있으면 true 없으면 false 가 나온다.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersa = "Hello are you there ?" if "ar" in a : print("True") else : print("NOPE") #답 TRUE dict에서는 해당하는 key값이 있으면 true 없으면 false 가 나온다. value 와는 아무런 관련이 없다는게 함정이다.
'언어 > 파이썬' 카테고리의 다른 글
id VS data_ptr() (1) 2021.01.01 numpy [...] (0) 2021.01.01 전역변수 global (0) 2020.12.29 파이썬에 관한 흥미로운 사실 (0) 2020.12.29 defaultdict() (0) 2020.12.28