Problem solving in python (checking password)


  1. write the code which checks if password is correct . password contains 6 elements : dict_of_pas = {0 : 4, 1 : 8, 2 : 15, 3 : 16, 4 : 23, 5 : 42}.user must input this password to log in with the password . if user input password correctly , code must tell you that you are welcome , if password will not be correct , code must tell you are not allowed .



dict_of_pas = {0 : 4, 1 : 8, 2 : 15, 3 : 16, 4 : 23, 5 : 42}
print("Enter a 6 elements password :: ")
Pw = [int(input()),int(input()),int(input()),int(input()),int(input()),int(input())]
if Pw[0] == dict_of_pas[0] and Pw[1]== dict_of_pas[1] and Pw[2] == dict_of_pas[2] and Pw[3] == dict_of_pas[3] and Pw [4] == dict_of_pas[4] and Pw [5] == dict_of_pas[5]:
    
    print("YOU ARE WELCOME.")

else:
    print("YOU AREN'T ALLOWED.")

Comments

Popular posts from this blog

How to solve an 8 puzzle problem using A* Algorithm in python

Timus Online Judge 1000. A+B Problem question and SOLVE with sudo code

URI Online Judge | 1013 The Greatest Solve with source code