Loop question

So I’ve really been working hard to learn python lately. I think I’ve been doing pretty well. I have most of the newbie stuff memorized and can write fairly simple programs without any guidance. However, I keep running into the same issue over and over. I’m not sure what i’m doing wrong so I was hoping someone could look at my code and tell me what’s wrong with it.

Here is the code:


#Enter your password. 


password = input("Please enter your password.")                    #set value of password
while password != "name":                                                   #while password is not = to "name"
    print("Access Denied.")                                                         #dispaly this message. "Works properly"
    if password == "name":                                                        #if the pass is correct
        print("Access granted.")                                                        #display this message. This is not working
                                                [INDENT=9]#properly and I'm not sure what i'm doing wrong. When i enter
                                                #name as the password the program just ends [/INDENT]


        password = input("Please enter your password.")                   #if pass is not right
                                                                                          #repeat loop.

I just can’t get access granted to appear after putting the pass in properly. I can’t figure out what’s goiin on. I’ve tried using break but it keeps giving me an error message. I hope someone can help and thanks if you can!

scratch that! I figured it out! I needed to repeate the loop only under the “while” condition and set the “if” condition to happen alone.