Test run


Test Run

I want to add a line of code which corrects the user if they input a non-integer.

Can't I write something like the following?

elif guess_row not int or guess_col not int:
print "Enter a number 1-5"

I get a traceback error with this bit of code. What am I doing wrong?


It will be bit of work, and if you are not familiar or comfortable with functional programming it will have you pulling your hair (maybe).

As a long term improvement (something to work on later) you might write a function that gets and validates the inputs and only returns integers that are in range. Otherwise it will take a conditional loop to de the same within your exisiting code.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.