Re: [Tutor] Programming Question

2006-09-19 Thread Hugo González M.
cimjls wrote: > > number = int(raw_input("Please enter a number between > 1 and 10: ")) > if number < 1: > print "That is an incorrect number. Please try > again." > raw_input("Please enter a number between 1 and 10: > ") > if number > 10: > print "That is an incorrect numb

Re: [Tutor] Programming Question

2006-09-19 Thread Hugo González M.
> if number > 10: > print "That is an incorrect number. Please try > again." Maybe you could do better if you check for all valid numbers first, and finally if no valid number has been entered, then print an error message, instead of checking for all possibilities of error. Hint: check that

Re: [Tutor] Programming Question

2006-09-19 Thread Kent Johnson
cimjls wrote: > Here is what I need to do: > > Create an IF branching statement that will take the > users input from 1-10 and return the English word for > the number. (1 is One, 2 is Two, etc.) If the user > enters a value outside of the range of 1-10, display > an error message, and ask the u

Re: [Tutor] Programming Question

2006-09-19 Thread naoki inada
> How do I get it to work after an incorrect number is > entered? I am stuck on this and would appreciate and > help or suggestions? Use exception >>> try: ... int("hoge") ... except(ValueError): ... print('incorrect') ... incorrect > elif number == 1: > print "One" > elif number == 2:

[Tutor] Programming Question

2006-09-19 Thread cimjls
Here is what I need to do: Create an IF branching statement that will take the users input from 1-10 and return the English word for the number. (1 is One, 2 is Two, etc.) If the user enters a value outside of the range of 1-10, display an error message, and ask the user to enter a valid selecti