Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. y=int(input())
  2. s=''
  3. x=y//1000
  4. if (x>0 and x<4):
  5.     s=s+x*'M'
  6. x=(y//100)%10
  7. if (x>0 and x<4):
  8.     s=s+x*'C'
  9. elif x==4:
  10.     s=s+'CD'
  11. elif x>4 and x<9:
  12.     s=s+'D'+(x-5)*'C'
  13. elif x==9:
  14.     s=s+'CM'
  15. x=(y//10)%10
  16. if (x>0 and x<4):
  17.     s=s+x*'X'
  18. elif x==4:
  19.     s=s+'XL'
  20. elif x>4 and x<9:
  21.     s=s+'L'+(x-5)*'X'
  22. elif x==9:
  23.     s=s+'XC'
  24. x=y%10
  25. if (x>0 and x<4):
  26.     s=s+x*'I'
  27. elif x==4:
  28.     s=s+'IV'
  29. elif x>4 and x<9:
  30.     s=s+'V'+(x-5)*'I'
  31. elif x==9:
  32.     s=s+'IX'
  33. print(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement