Week 3 assignment 3

mail@pastecode.io avatar
unknown
python
10 months ago
492 B
3
Indexable
from datetime import *

p1_name = input()
p1_dob = input()
p2_name = input()
p2_dob = input() 

p1_date = p1_dob.split('-')
p2_date = p2_dob.split('-')


for idx in range(len(p1_date)):
    p1_date[idx] = int(p1_date[idx])
    p2_date[idx] = int(p2_date[idx])

p1_date = date(p1_date[-1], p1_date[-2], p1_date[-3])
p2_date = date(p2_date[-1], p2_date[-2], p2_date[-3])

if p1_date > p2_date:
    print(p1_name)
elif p1_date < p2_date:
    print(p2_name)
else:
    print(min(p1_name, p2_name))
Leave a Comment