본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 5

반응형

Q>

[1, 2, 3, 4, 5]라는 리스트를 [5, 4, 3, 2, 1]로 만들어 출력하시오.

(리스트의 순서를 뒤집는 함수를 사용해야 합니다.)


A>

list_num = [1, 2, 3, 4, 5]
list_num.reverse()

print(list_num)


O>

[5, 4, 3, 2, 1]


Process finished with exit code 0



반응형

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

Python Learn the basics Quiz 7  (0) 2019.03.16
Python Learn the basics Quiz 6  (0) 2019.03.16
Python Learn the basics Quiz 4  (0) 2019.03.16
Python Learn the basics Quiz 3  (0) 2019.03.16
Python Learn the basics Quiz 2  (0) 2019.03.16