Code: Select all
accounts = {}
def login():
f = open("ANZData.txt", "a")
y = 0
count = 0
while y != 1:
print("whats your username? ")
loginuser = input()
print("whats your password? ")
loginpass = input()
print("whats your PIN ")
loginpass = input()
# Open the file in read mode
with open('ANZData.txt', 'r') as file:
# Read each line in the file
for line in file:
#CODE NEEDED HERE
def register(accounts):
print("what is your username?")
user = input("enter username:")
print("what is your Password? ")
passw = input("enter password: ")
print("please provide us a pin number to use")
PIN = input("enter PIN: ")
with open('ANZData.txt', 'a') as f:
f.write("name: " + user + " Password: " + passw + " PIN: " + PIN + '\n')
with open('ANZData.txt', 'r') as file:
for line in file:
key, value = line.strip().split(':', 1)
accounts[key.strip()] = value.strip()
print(accounts)
#Main code starts here:
#--------------------------------------------------------------------------------------------#
x=1
while x != 0:
print(accounts)
print("Would you like to login or register?")
logintoken = input("")
if logintoken == "enter":
registr = register(accounts)
elif logintoken == "login":
x=0
logi = login()
else:
print("try again")
x=1
while x != 0:
print(accounts)
print("\n Do you want to withdraw, deposit or check balance?")
decision = input("")
if decision.upper == "Balance":
print("placeholder")
< /code>
Ich habe versucht zu schreiben: < /p>
if loginuser and loginpass in file.readlines():