[Tutor] Why can't I make this function work?
smith-matt at tiscali.co.uk
Thu Jul 15 21:35:56 CEST 2004
I have written the following function as part of my guessing game program
(as discussed in another thread):
"Function to collect an integer from the user"
type_check = 0
while type_check == 0:
int = raw_input()
if type(int) != type(1):
print "Invalid input"
type_check = 1
I think the function should keep taking input until an integer is input,
at which point it should return the value to the main program. The
function does not cause the program to crash but it doesn't accept any
input (returns "Invalid input" whatever I type). Changing the type_check
variable should cause the while loop to exit, shouldn't it?
Thanks for all the help,
More information about the Tutor