Advertisement
makispaiktis

Century From Year

Jan 7th, 2020 (edited)
400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.39 KB | None | 0 0
  1. '''
  2. Introduction
  3. The first century spans from the year 1 up to and including the year 100
  4. The second - from the year 101 up to and including the year 200, etc.
  5. '''
  6.  
  7. def century(year):
  8.     remaining = year % 100
  9.     if remaining == 0:
  10.         return int(year / 100)
  11.     else:
  12.         return int(year / 100) + 1
  13.  
  14. # Main Function
  15. print(century(1900))
  16. print(century(1905))
  17. print(century(60))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement