This Python code allows users to create an account by entering a name and password. It stores account information in lists and writes log entries to individual text files for each user. The code runs in a loop, prompting the user to sign up, log in with an existing account, view existing accounts, or exit the program. If logging in, it checks the password and allows the user to write an entry, responding with different audio clips based on keywords in the entry.
This Python code allows users to create an account by entering a name and password. It stores account information in lists and writes log entries to individual text files for each user. The code runs in a loop, prompting the user to sign up, log in with an existing account, view existing accounts, or exit the program. If logging in, it checks the password and allows the user to write an entry, responding with different audio clips based on keywords in the entry.
This Python code allows users to create an account by entering a name and password. It stores account information in lists and writes log entries to individual text files for each user. The code runs in a loop, prompting the user to sign up, log in with an existing account, view existing accounts, or exit the program. If logging in, it checks the password and allows the user to write an entry, responding with different audio clips based on keywords in the entry.
date = str(datetime.datetime.now()) account=[] showingaccount=[] def process(date,text,filename): f = open(filename, 'a') f.write(date) f.write('\n') f.write(text) f.write('\n') f.close() def showowner(people,password,showingaccount): account.append(people) account.append(password) showingaccount.append(people) running=True while running: choose=input("\033[0;30;47mwhat are you gonna do? if you are the first time using this code, please enter a. if you already having an account, please enter b. if you wanna check who is already having an account, please enter c.if you wanna end this programme forever,please enter d") if choose=="a": people = input("what is your name?") password =input("what do you want for password?") showowner(people,password,showingaccount) print("You are sign up successfully! if you wanna write inside, press b.") playsound('zhuce.mp3') if choose=="b": people = input("what is your name?") passwordin=input("please enter your password.") for i in range(0, len(account)): if account[i] == people: i = i + 1 if passwordin==account[i]: filename = (people + ".txt") text = input("How's your day?") process(date, text, filename) stext = text.split() number = len(stext) for i in range(0, number): if stext[i] == "happy": print("\033[1;32;40m I am happy for you! ") playsound('ha.mp3') elif stext[i] == "sad": print("\033[1;31;40m I am sorry for hearing that. ") playsound('sa.mp3') else: print("wrong password! you can not log in to others account.") playsound('bad.mp3') elif choose=="d": running=False elif choose=="c": print(showingaccount)