본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 11

반응형

Q>

1. 리스트 [True, False, False, True, False] 가 있다.

2. 위에 리스트 내용을 반전 시키는 프로그램을 작성하시오.


A>

check_list = [True, False, False, True, False]
print(check_list)

boolean_list = []

for i in check_list:
if i == True:
boolean_list.append(False)
else:
boolean_list.append(True)

print(boolean_list)


O>

[True, False, False, True, False]

[False, True, True, False, True]


Process finished with exit code 0

반응형

'Python_Matter > Solve' 카테고리의 다른 글

Python Learn the basics Quiz 13  (0) 2019.03.18
Python Learn the basics Quiz 12  (0) 2019.03.18
Python Learn the basics Quiz 10  (0) 2019.03.18
Python Learn the basics Quiz 9  (0) 2019.03.16
Python Learn the basics Quiz 8  (0) 2019.03.16