Question: loop = 1 Login_Attemp_Count = 0 password = hello while loop == 1: # part 1 - reading correct password readPWD = raw_input(Please enter password:)

loop = 1 Login_Attemp_Count = 0

password = "hello"

while loop == 1:

# part 1 - reading correct password

readPWD = raw_input("Please enter password:") if readPWD != password: print "That was not a valid password, please try again. " Login_Attemp_Count = Login_Attemp_Count + 1 if Login_Attemp_Count == 3: print "Password attempts reached 3 times, the program ends now. " loop = 0 else: print "Welcome to the second half of the program!" name = raw_input("Please enter your name:") if name == "Clairrem" or name == "clairrem": print "What a great name!" elif name == "Madonna" or name == "Cher": print "May I have your autograph, please?" else: print name + ", that is a nice name."

loop == 0

Please help, I don't know what am I doing wrong. I need the program to ask me for a password and when I enter the correct one it should continue with the program, if i don't, I get 3 chances then the program terminates. Right now when I test it even if I entered the wrong password it still continues to do the program.

This is the output right now:

Please enter password:hi That was not a valid password, please try again.

Welcome to the second half of the program! Please enter your name:

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!