You are on page 1of 2

import datetime

from playsound import playsound


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)

You might also like