Alright so here's the code
def user_password():
input('Please Enter Password: ')
#profiles
def intercept():
user_password()
if user_password == "intercept":
print("this is working so far")
else:
print("Incorect Password")
def Jimmy():
user_password()
if user_password == "Jimmy":
print("this is working so far")
else:
print("Incorect Password")
def Tommy():
user_password()
if user_password == "Tommy":
print("this is working so far")
else:
print("Incorect Password")
#login
user_functions = dict(
intercept=intercept,
Jimmy=Jimmy,
Tommy=Tommy,
# ...
)
user_input = input("Input function name: ")
if user_input in user_functions:
user_functions[user_input]()
else:
print("Error: Unknown function.")
PROBLEMS:
- My code always starts with asking for the password even though I don't want it
to.
- When I change the first variable to a function it fixes this
- Why does it execute when I'm just setting the variable. I'm pretty sure I shouldn't have to use a function instead of a variable
- No matter what it always ends up as Incorrect Password even if I give the correct password
=doesn't mean "make the thing on the left shorthand for the operation on the right". It means "do the thing on the right, and make the thing on the left a name for the object produced by doing the thing on the right".