username = input("Please enter your username: ")
username0 = username
username1 = username.find(" ")
username2 = username.isdigit
username3 = len(username)
password = input("Please enter your password: ")
password1 = len(password)
password2 = password.find("!, @, #, $, %, ^, &, *, (, ), -, _, +, =, `, ~, {, [, }")
password3 = password.find("], |, :, ;, ', ,, ., ?, /")
if username1 == -1:
pass
elif username1 >= 0:
print("Your username can not contain spaces.")
breaker1 = 1
if username2:
pass
elif not username2:
print("Your username can not contain numbers.")
breaker2 = 2
if username3 > 12:
print("Your username can not be more than 12 characters.")
elif username3 <= 12:
pass
breaker3 = 3
if password1 > 12:
print("Your password can not be more than 12 characters.")
elif password1 <= 12:
pass
if password2 == -1:
pass
elif password2 >= 0:
print("Your password can not contain symbols.")
elif password3 == -1:
pass
elif password3 >= 0:
print("Your password can not contain symbols.")
password4 = password.replace("a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q", "*")
password5 = password.replace("r, s, t, u, v, w, x, y, z","*")
print("Your username is " + username + " and your password is " + password + ".")
print(username2)
I'm trying to make a code that can take your username and password, remember it, then be able to lock you out or let you in on whether or not you entered the right username and password.
I've tried rewriting certain areas, I've tried using the ai provided by the website I use to code, I tried breaking up the if statements (which is what "Breaker1 = 1" means, I thought maybe the strings of if statements was messing with the pass command). Keep in mind, I'm still relatively new to coding, I've only started learning python since about a week ago. I'm hoping someone could shed some insight on this? Thanks!
Here is a bit of code with some useful functions that you can use. It allows you to register a username and password and store it in a text file in the same directory. That way it saves after your code stops running. This is not at all secure but as a beginner project it works.