Advertisement
Guest User

Untitled

a guest
Dec 5th, 2020
1,372
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. class Solution:
  2. def intToRoman(self, num: int) -> str:
  3.  
  4. sym = {"M":1000,"CM":900,"D":500,"CD":400,"C":100,"XC":90,"L":50,"XL":40,"X":10,"IX":9,"V":5,"IV":4,"I":1}
  5. output = ""
  6. for key, value in sym.items():
  7. temp = num//value
  8. num = num%value
  9. output = output +key*temp
  10.  
  11. return output
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement