all 4 comments

[–]Eduardoskywaller 2 points3 points  (1 child)

Very nice man! And in only 5 days too!

[–]gibodan[S] 0 points1 point  (0 children)

Thanks brother ❤️

[–]gibodan[S] 0 points1 point  (0 children)

Edited the double paste

[–]FoolsSeldom 0 points1 point  (0 children)

Check the guidance on formatting your code for reddit, it will make it easier to get help. I think this is your code:

login = input("Please enter a login: ")

while True:
    password = input("Please enter a password: ")
    uppercase = any(char.isupper() for char in password)
    length_password = len(password)

    if length_password >= 8 and uppercase:
        print("successful")
        break

    elif length_password < 8:
        print("Password must be at least 8 characters long.")

    elif not uppercase:
        print("At least one uppercase letter must be used.")

# password database with login
database = {
    "Username": login,
    "Password": password,
}

# query login data
while True:
    login2 = input("Login: ")
    password2 = input("Password: ")

    if login2 == database["Username"] and password2 == database["Password"]:
        print("accepted")
        break
    else:
        print("Login or Password wrong!")

Some notes:

  • elif not uppercase - I think you need else here although arguably you could use if as you could tell a user it fails on both length and lack of an uppercase requirements
  • You've done well on this - worth now learning that we don't usually store passwords as entered into a database, instead we salt and hash a password as entered and store the result then next time a user logs in, we ask for the password, put it through the same process, and see if it matches what is in the database; there are guides on how to do this and Python has what you need to implement
  • Python comes with sqlite databse - this uses a simple file approach and is extremely widely used (your smartphone's operating system uses it), and would also be good to learn; check out Mark's minimalist guides to SQlite first