I start to learn python a couple of days ago,Im trying to make some kind of login interface with multiple passwords options but can't figure out the right way to make it loop until I enter the right password ,I tried to use "while" but cant seem to figure out the syntax and placement with it in my code,I want it to repeat the first block of code if "else" is the result so I can try and type the password again,please help?
import random
male = random.choice([True, False])
import random
num = random.choice(["1", "0"])
name = "joe"
user_input= input ("insert Password here ")
if ((user_input == "joey") or (user_input == "loki")):
if male == True: print("hello")
if male == False: print("wellcome")
if name == "joe":
if num == "1":
print("hi world")
if name == "joe":
if num == "0":
print("nice")
if name + num == ("joe" + "0"):
print("thats working")
else:
print ("Wrong Password,Please try again.")