I want to return x and y from the functions but when I put in return x or y, it still says it is undefined. Could someone help me figure out where I’m going wrong?
import time
usernames = 'Codswollop'
passwords = 'Fishcake420'
def password():
x = input('Please enter your password: ')
if len(x) < 8:
print('Password not long enough. Please try again. ')
password()
else:
print('Thank you!')
return x
def username():
y = input('Please enter your username: ')
contains_digit = False #starts as false
for i in list(y): #repeats the amount of times there are characters in the username.
if i.isdigit(): #if i, the iteration (each character), is a digit:
contains_digit = True #set to true because a digit was detected
if contains_digit == True: #if a digit was detected then:
print('Contains digit. Please try again. ')
time.sleep(1)
username() #restarts function, asking for username again
else:
return y
username()
password()
if y == usernames:
if x == passwords:
print('access granted')

2 comments
bro take a look at lua syntax.
@CaioAlpaca its python not lua, I thought I could post python on here but oops