# Assignment 3 exercise 1 # Convert user inputted number to a roman numeral # Cory Parker 4/13/15 startnumber = input('Enter a number between 1-10, and this program will convert it to a roman numeral: ') roman = ['I', 'II', 'III', 'IV', 'V', 'VI', 'VII', 'VIII', 'VIV', 'X'] #This section figures out which roman numeral matches the user input if (startnumber < 1 or startnumber > 10): print 'You have selected an incorrect number!' elif startnumber == 1: print roman[0] elif startnumber == 2: print roman[1] elif startnumber == 3: print roman[2] elif startnumber == 4: print roman[3] elif startnumber == 5: print roman[4] elif startnumber == 6: print roman[5] elif startnumber == 7: print roman[6] elif startnumber == 8: print roman[7] elif startnumber == 9: print roman[8] elif startnumber == 10: print roman[9]
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