+ 2

How to indexing if i have too many years in this code?

https://code.sololearn.com/cY6tov03CESM/?ref=app

8th May 2022, 2:42 PM
Nafi Rahat Rahman
7 Respostas
+ 4
def print_hi(name): print("Hi,", name) print_hi("Nafi Rahat Rahman") birth_year = int(input("Input birth year:")) print("Age", 2022-birth_year)
8th May 2022, 3:01 PM
Jayakrishna 🇮🇳
+ 1
Why you need list? 2022 - input will return age. Is not it?
8th May 2022, 2:56 PM
Jayakrishna 🇮🇳
+ 1
Nafi Rahat Rahman import time current_year = time.gmtime().tm_year print(current_year)
8th May 2022, 3:20 PM
Jayakrishna 🇮🇳
0
Yeah
8th May 2022, 3:00 PM
Nafi Rahat Rahman
0
How to input date and time module to do this
8th May 2022, 3:04 PM
Nafi Rahat Rahman
0
You can do the following to get the current year: import datetime current_year = datetime.datetime.now().year
8th May 2022, 3:08 PM
Sousou
Sousou - avatar