I want the while loop to run as long as the name is not "1234". And if the name is only spaces, I want to print "name can not be only spaces" and ask for a name again. Else I want it to just ask for a name again.
name=input("")
while (name!="1234"):
if(name.isspace):
print ("name can not be only spaces")
name=input("")
else:
name=input("")
The problem I have is that it prints "name can not only be spaces" for whatever string I give it. Even if the string does not have spaces it prints the if statement. What is going on?
Aucun commentaire:
Enregistrer un commentaire