Skip to content
Advertisement

Why my Python print command not working after “if” function? [closed]

Why my code doesn’t write “good job”? It only jumps after “inp_user” and “inp_pin” to “question” imput.

…and loog not working too :D

username = "boy"
pin = 123
inp_user = input("User: ")
inp_pin = int(input("Pin: "))

def loop():
    if inp_user == username and inp_pin == pin:
        print("Good Job")
    else:
        print("Bruh")

question = input("again?: ")

def second():
    if question == "Yes":
        loop()
    else:
        exit

Advertisement

Answer

your code won’t work because you don’t call the cunctions you have defined

Try This:

username = "boy"
pin = 123

    
while True:

    inp_user = input("User: ").strip()
    inp_pin = int(input("Pin: ").strip())

    if inp_user == username and inp_pin == pin:
        print("Good Job")
    else:
        print("Bruh")
        question = input("again?: ")
        if question.strip() != "Yes":
            break
Advertisement