Aug-06-2018, 12:27 PM
[Help] Convert integer to Roman numerals? {Screenshot attached}
Hi,
Please see attached screenshot for the current exercise that I'm trying to execute?
[Image: 060818_zps7cdg6nrb.png]
Tbh, I am also unsure with my code. I gathered the idea from here (https://stackoverflow.com/questions/2877...n-numerals)
===================================================================
Here's my currentcode:
Error:
Any advice is much appreciated! :)
Thank you in advance!
Hi,
Please see attached screenshot for the current exercise that I'm trying to execute?
[Image: 060818_zps7cdg6nrb.png]
Tbh, I am also unsure with my code. I gathered the idea from here (https://stackoverflow.com/questions/2877...n-numerals)
===================================================================
Here's my currentcode:
print("[System] Hi! Enter any number between 1 and 3000 so the program will show you the old-school Roman numeral. In other words, 4 should return 'IIII'. Ready?!") num_map = [(1000, 'M'), (500, 'D'), (100, 'C'), (50, 'L'), (10, 'X'), (5, 'V'), (1, 'I')] num = int(input("Enter any number between 1 and 3000: ")) def num2roman(num): while num > 0: for key, val in num_map: while num >= 1: print(num_map.values()) num2roman(num)===================================================================
Error:
Error:Traceback (most recent call last):
File "soc-wk1day4h-cert-vanessa-dunford.py", line 25, in <module>
num2roman(num)
File "soc-wk1day4h-cert-vanessa-dunford.py", line 24, in num2roman
print(num_map.values())
AttributeError: 'list' object has no attribute 'values'
===================================================================Any advice is much appreciated! :)
Thank you in advance!