Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Римские примеры
- keys = [1000, 900, 500, 400, 100, 90, 50, 40, 10, 9, 5, 4, 1]
- values = ['M', 'CM', 'D', 'CD', 'C', 'XC', 'L', 'XL', 'X', 'IX', 'V', 'IV', 'I']
- def to_roman(n):
- pointer = 0
- result = ''
- while n > 0:
- while n >= keys[pointer]:
- n -= keys[pointer]
- result += values[pointer]
- pointer += 1
- return result
- def roman():
- global one, two, three
- three = one + two
- print(to_roman(one), "+", to_roman(two), "=", to_roman(three))
- one = 5
- two = 4
- roman()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement