a = False
while a == False:
quant = int(input("Input the size:\n"))
if type(quant) == int:
a = True
else:
print('Please use numbers:\n')
a = False
I'm trying to make it so that the user can't input characters, but if they do, it prints out the second message. However, when I try to input characters, this message appears:
Traceback (most recent call last):
File "C:/Users/user/Desktop/pythonproject1/Actual Projects/password
generator/Password_generator.py", line 34, in <module>
quant = int(input("Input the:\n"))
ValueError: invalid literal for int() with base 10: 'thisiswhatIwrote'
It works fine when inputing integers.
I have tried isinstance()
and is_integer()
, but couldn't get them to work, so just tried to make it simple.