6
I have this code but it doesn’t work very well, I mean, if it’s whole at first numOfValues
is correct, but if it is not gets the type None
, for what remains in memory is the first input (which is not integer). I would like that, regardless of the attempts I make, the numOfValues
always had the value of the last input, and the function stopped when inserting an integer, so it would be numOfValues = INT
(when the function returns x
)
def return_int():
x = raw_input("Number of names to insert?\n")
try:
int(x)
return int(x)
except ValueError:
print "must be an integer"
return_int()
numOfValues = return_int()
print numOfValues
...
Believe me very well. Thank you
– Miguel