I want to create a class based user registration portal and for that I wanted to add some usernames. But if they are already taken, then the code should prompt the user to add another username and I tried to do so with this code.
a=0
User=['name123']
username=raw_input("Enter username : ")
while a==0:
for i in User:
if i==username:
a=0
break
else:
a=1
if a==0:
usernarme=raw_input("Username already taken.\nEnter another username :")
But it gets stuck in the loop and displays the following message repeatedly even after entering a valid username. What I am doing wrong?
"Username already taken"
class
tag if there is noclass
in provided snippet ? – Yaroslav Surzhikov Oct 21 '17 at 14:56