def choices():
print("Please choose what you would like to do.")
choice = int(input("For Signing Up Type 1 and For Signing In Type 2: "))
if choice == 1:
print("Please Provide")
username = str(input("Username: "))
f = open("usernames.txt", 'r')
info = f.read()
if username in info:
print("Username unavailable. Please Try Again.")
return print(choices())
f.close()
password = str(input("Password: "))
f = open("passwords.txt", 'r')
info1 = f.read()
f.close()
f = open("usernames.txt", 'w')
info = info + " " + username
f.write(info)
f.close()
f = open("passwords.txt", 'w')
info1 = info1 + " " + password
f.write(info1)
f.close()
print("Congratulations! You have successfully created an account. You may now login in.")
return print(choices())
elif choice == 2:
print("Please Provide")
username = str(input("Username: "))
f = open("usernames.txt", 'r')
info = f.read()
if username in info:
password = str(input("Password: "))
f = open("passwords.txt", 'r')
info1 = f.read()
if password in info1:
print("Welcome Back " + username + "!")
else:
print("Your password is incorrect. Please try again.")
return print(choices())
else:
print("Your username is either incorrect or nonexistent. You can either try again or create a new account.")
return print(choices())
else:
raise TypeError
print(choices())
```
def choices():
print("Please choose what you would like to do.")
choice = int(input("For Signing Up Type 1 and For Signing In Type 2: "))
if choice == 1:
print("Please Provide")
username = str(input("Username: "))
f = open("usernames.txt", 'r')
info = f.read()
if username in info:
print("Username unavailable. Please Try Again.")
return print(choices())
f.close()
password = str(input("Password: "))
f = open("passwords.txt", 'r')
info1 = f.read()
f.close()
f = open("usernames.txt", 'w')
info = info + " " + username
f.write(info)
f.close()
f = open("passwords.txt", 'w')
info1 = info1 + " " + password
f.write(info1)
f.close()
print("Congratulations! You have successfully created an account. You may now login in.")
return print(choices())
elif choice == 2:
print("Please Provide")
username = str(input("Username: "))
f = open("usernames.txt", 'r')
info = f.read()
if username in info:
password = str(input("Password: "))
f = open("passwords.txt", 'r')
info1 = f.read()
if password in info1:
print("Welcome Back " + username + "!")
else:
print("Your password is incorrect. Please try again.")
return print(choices())
else:
print("Your username is either incorrect or nonexistent. You can either try again or create a new account.")
return print(choices())
else:
raise TypeError
print(choices())