I have this question about lists so I created this code as a great example, I want to create a list of names so that when I login it can refer to the list of names listed here and I won't get an "Access Denied". I tried doing it using visual studio code but it still doesn't work, any ideas how to correct this? Or maybe if statements are not the right choice for this kind of code?
def name_login():
list_of_names = ["Alice", "Bob", "Apple"]
name = input("Name: ")
if name in list_of_names:
print("Welcome back %s" % (name))
name_login()
else:
if len(name) > 0:
print("Access Denied")
else:
print("Invalid Input")