Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #reminder
- breaking_loops=True
- print("Hi, this is my first program.")
- print("Maybe there are some bug.")
- print("First, you have to write down that which tool will you use.")
- while breaking_loops==True:
- print("Enter 'address book' to use adress book.")
- print("Enter 'my passwords' to use my passwords.")
- print("Enter 'quit' to leave the program.")
- begin_input=input(": ")
- #quit the program
- if begin_input=="quit":
- while True:
- print("Quitting...")
- breaking_loops=False
- break
- # if address book
- elif begin_input=="address book":
- while True:
- print("Enter 'add', to add an adress.")
- print("Enter 'delete', to delete all of your adresses.")
- print("Enter 'view' to view you adresses.")
- print("Enter 'quit' to leabe the program.")
- user_input=input(": ")
- try:
- addresses=open("addresses.txt","r")
- finally:
- addresses.close()
- # add address function
- def add_address():
- try:
- append_addresses=open("addresses.txt","a")
- your_address=input(str("Your address, that you want to fix in the program: "))
- append_addresses.write(your_address+"\n")
- print("Address added to your file!")
- finally:
- append_addresses.close()
- # delete address function
- def delete_addresses():
- try:
- deleting_addresses=open("addresses.txt","w")
- print("Deleting...")
- finally:
- deleting_addresses.close()
- # view address function
- def view_addresses():
- try:
- viewing_addresses=open("addresses.txt","r")
- print("Your addresses: ")
- print(viewing_addresses.read())
- finally:
- viewing_addresses.close()
- # if user input = something
- if user_input=="quit":
- print("Quitting...")
- breaking_loops=False
- break
- elif user_input=="add":
- add_address()
- elif user_input=="delete":
- delete_addresses()
- elif user_input=="view":
- view_addresses()
- # if my passwords
- elif begin_input=="my passwords":
- while True:
- print("Enter 'add' to add a password.")
- print("Enter 'delete' to delete.")
- print("Enter 'view' to view your passwords.")
- print("Enter 'quit' to leave the program.")
- user_input1=input(": ")
- try:
- passwords=open("passwords.txt","r")
- finally:
- passwords.close()
- # add password function
- def add_password():
- try:
- append_passwords=open("passwords.txt","a")
- your_password=input(str("Your password, that you want to remember: "))
- append_passwords.write(your_password+"\n")
- print("Password added to your password list!")
- finally:
- append_passwords.close()
- # add delete function
- def delete_passwords():
- try:
- deleting_passwords=open("passwords.txt","w")
- print("Deleting...")
- finally:
- deleting_passwords.close()
- # add view function
- def view_passwords():
- try:
- viewing_passwords=open("passwords.txt","r")
- print("Your passwords: ")
- print(viewing_passwords.read())
- finally:
- viewing_passwords.close()
- # if user_input1 = something
- if user_input1=="quit":
- print("Quitting...")
- breaking_loops=False
- break
- elif user_input1=="add":
- add_password()
- elif user_input1=="delete":
- delete_passwords()
- elif user_input1=="view":
- view_passwords()
- else:
- print("You probably entered something wrong.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement