SHARE
TWEET

Untitled

a guest Jul 15th, 2019 67 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top