How to indexing if i have too many years in this code?
def print_hi(name): print("Hi,", name) print_hi("Nafi Rahat Rahman") birth_year = int(input("Input birth year:")) print("Age", 2022-birth_year)
Why you need list? 2022 - input will return age. Is not it?
Nafi Rahat Rahman import time current_year = time.gmtime().tm_year print(current_year)
How to input date and time module to do this
You can do the following to get the current year: import datetime current_year = datetime.datetime.now().year