#Melissa Hensley #CIS 122 #Chapter 4 Exercise 1. #Roman Numerals one = 1 two = 2 three = 3 four = 4 five = 5 six = 6 seven = 7 eight = 8 nine = 9 ten = 10 numeral_1 = "I" #Lists are EVIL, I know there is a better way to do this... numeral_2 = "II" numeral_3 = "III" numeral_4 = "IV" numeral_5 = "V" numeral_6 = "VI" numeral_7 = "VII" numeral_8 = "VIII" numeral_9 = "IX" numeral_10 = "X" number = input("Please input a numer between 1 and 10: ") if number == one: print("This is your Roman numeral: ") + numeral_1 elif number == two: print("This is your Roman numeral: ") + numeral_2 elif number == three: print("This is your Roman numeral: ") + numeral_3 elif number == four: print("This is your Roman numeral: ") + numeral_4 elif number == 5: print("This is your Roman numeral: ") + numeral_5 elif number == 6: print("This is your Roman numeral: ") + numeral_6 elif number == 7: print("This is your Roman numeral: ") + numeral_7 elif number == 8: print("This is your Roman numeral: ") + numeral_8 elif number == 9: print("This is your Roman numeral: ") + numeral_9 elif number == 10: print("This is your Roman numeral: ") +numeral_10 else: print("That was not a valid number, please try again.")
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question