def romanConversion():
roman = 0
print 'Enter a number between 1 and 10 and I will convert it to a Roman Numeral'
roman = raw_input ('Enter your number: ')
while not roman.isdigit():
print 'You did not enter a number between 1 and 10! Try again!'
roman = raw_input ('Enter a number between 1 and 10 please!')
roman = int(roman)
if roman == 1:
print 'The roman numeral conversion for 1 is I'
if roman == 2:
print 'The roman numeral conversion for 2 is II'
if roman == 3:
print 'The roman numeral conversion for 3 is III'
if roman == 4:
print 'The roman numeral conversion for 4 is IV'
if roman == 5:
print 'The roman numeral conversion for 5 is V'
if roman == 6:
print 'The roman numeral conversion for 6 is VI'
if roman == 7:
print 'The roman numeral conversion for 7 is VII'
if roman == 8:
print 'The roman numeral conversion for 8 is VIII'
if roman == 9:
print 'The roman numeral conversion for 9 is XI'
if roman == 10:
print 'The roman numeral conversion for 10 is X'
With the code I have now I can enter a letter and it will give me an error. If I enter a number greater than 10 the program will still run and I dont want it to do that. I really have not idea how to make it flag both.
Ive tried google searches but have had not luck in trying to figure it out. Any help in the right direction would be greatly appreicated
This post has been edited by Motoma: 29 November 2011 - 12:39 PM
Reason for edit:: Fixed your [code] tags.

New Topic/Question
Reply


MultiQuote



|