본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 1

반응형

Q>

1. year라는 변수에 자신이 태어난년월일을 할당합니다.

2. age라는 변수에 year변수를 사용하여 자신의 나이를 계산하여 할당하고 결과를 출력합니다.


A>

year = '19860109'

age = 2019 - int(year[:4])

print(age)


O>

33


Process finished with exit code 0

반응형

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

Python Learn the basics Quiz 6  (0) 2019.03.16
Python Learn the basics Quiz 5  (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