Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import datetime
- def task2():
- first_person = input("Enter dob and name of the first person in format DD/MM/YYYY-name: ").split("-")
- second_person = input("Enter dob and name of the second person in format DD/MM/YYYY-name: ").split("-")
- first_dob = datetime.datetime.strptime(first_person[0], "%d/%m/%Y")
- second_dob = datetime.datetime.strptime(second_person[0], "%d/%m/%Y")
- if first_dob == second_dob:
- print(f"{first_person[1]} and {second_person[1]} are the same age.")
- elif first_dob > second_dob:
- print(f"{second_person[1]} is older.")
- else:
- print(f"{first_person[1]} is older.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement