Advertisement
Guest User

Untitled

a guest
Jun 25th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.31 KB | None | 0 0
  1. numerals = {"I": 1, "V": 5, "X": 10, "L": 50, "C": 100, "D": 500, "M": 1000}
  2.  
  3.  
  4.  
  5. def convert(roman):
  6. amount = 0
  7. if roman in numerals:
  8. for roman in numerals:
  9. if numerals[roman] > numerals["V"]:
  10. amount += numerals[roman]
  11. print(amount)
  12. else:
  13. print(0)
  14.  
  15.  
  16. convert("I")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement