Thanks Peter - I finally got back to working on this while my dog was having a
panic attack from a thunderstorm about 430 AM. :-) She is asleep as my feet.
Anyway, great example and it showed me exactly what i needed to do, AND what I
was doing wrong.
I appreciate your help!
On May 3, 201
I am reading the documentation and I'm in the section 4.1. Let me
write it down here:
>>> x = int(input("Please enter an integer: "))
Please enter an integer: 42
>>> if x < 0:
... x = 0
... print('Negative changed to zero')
... elif x == 0:
... print('Zero')
... elif x == 1:
...
On 5/5/2012 11:01 AM Santosh Kumar said...
I am reading the documentation and I'm in the section 4.1. Let me
write it down here:
You'll need to peek ahead to section 8 Errors and Exceptions.
Try and see if that doesn't get you going.
Emile
x = int(input("Please enter an integer: "))
Pl
Python novice here. Caveat emptor.
Since all python input is read in as a string, you could try checking
to see if the value is a digit with the .isdigit string method.
e.g.
if userinput.isdigit():
#do stuff
else
#more stuff
http://stackoverflow.com/questions/5424716/python-how-to-check-if-
On 05/05/12 19:01, Santosh Kumar wrote:
x = int(input("Please enter an integer: "))
Please enter an integer: 42
Now I want to add a filter in this script, I want when a user enter a
string here it give a warning "Please enter a number like 0 or 2".
What happens if the user does not enter