Mar-28-2019, 01:56 AM
isdigit returns True if the string is all digits, but only if you call it (
num.isdigit()
). It's not clear exactly what you are trying to do, but if you need to see that the number is 9 digits long, you want len(num) == 9
. Your atempt variable is just going to cause errors, because you never define atempt anywhere and then try to test it. I would just do a while True:
loop, and break when the number is valid. I would also indent that else clause to tie it to the if, not the while.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures