+ 2

Years to Century

I want to input a year like 2017 and then turn that into the century its in only using mathematical equations without the module. 2000 is the 20th and 1901 is the 20th.

8th Sep 2017, 3:44 PM
Danix The Great
2 Answers
+ 1
this isn't much of an answer but what I would do would be divide it by 100 and subtract 1 from that float.
8th Sep 2017, 4:11 PM
Michael - avatar
+ 1
num=input("Enter The Year - ") cen=num cen=cen[:2] cen=int(cen)+1 print("The year {}, is in the {}th century".format(num,cen)) I got the year input. Next I cut it into the first 2 digits. finally I turned those into numbers and added one, giving me the century. Printed it. There is probably a better way, but it did the trick
8th Sep 2017, 4:35 PM
LordHill - avatar