# Week 3 Ex 1: This program converts whole numbers within the range 1-10 into Roman numerals # Written by Greg Lamb. # Last modified on 04/10/2015 #Get number between 1-10 Number=input('Enter a number between 1-10: ') print Number #Display error message if number is outside of range 1-10 if (Number < 1 or Number > 10): print('Error, your number is outside of the range') #Convert number to Roman numeral if (Number == 1): print 'Roman Numeral = I' elif (Number == 2): print 'Roman Numeral = II' elif (Number == 3): print 'Roman Numeral = III' elif (Number == 4): print 'Roman Numeral = IV' elif (Number == 5): print 'Roman Numeral = V' elif (Number == 6): print 'Roman Numeral = VI' elif (Number == 7): print 'Roman Numeral = VII' elif (Number == 8): print 'Roman Numeral = VIII' elif (Number == 9): print 'Roman Numeral = IX' elif (Number == 10): print 'Roman Numeral = X'
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