hey guys i was playing around with my small project and i hit this problem on how to repeat a function i have tried to call the function it self with in the while loop but did not work maybe use another function to do so like calling another function to call this one again
code is as follows:
#this function is to check user and pass that was entered by the user using the inputs function
def chk(u = str(a[0]), p = int(a[1])):
while u not in sales_man.keys():
call this function again
If you're trying to implement a simple login you can use a classic infinite loop like:
def check_user(user):
return user in sales_man.keys()
while True:
# [...] get username in input
if check_user(username):
# [...] ok, check password
else:
# [...] wrong user
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.