Advertisement
Guest User

Untitled

a guest
Oct 12th, 2017
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 3.40 KB | None | 0 0
  1. #reminder
  2. breaking_loops=True
  3.  
  4. print("Hi, this is my first program.")
  5. print("Maybe there are some bug.")
  6. print("First, you have to write down that which tool will you use.")
  7.  
  8.  
  9. while breaking_loops==True:
  10.     print("Enter 'address book' to use adress book.")
  11.     print("Enter 'my passwords' to use my passwords.")
  12.     print("Enter 'quit' to leave the program.")
  13.     begin_input=input(": ")
  14.  
  15.      #quit the program
  16.     if begin_input=="quit":
  17.         while True:
  18.             print("Quitting...")
  19.             breaking_loops=False
  20.             break
  21.  
  22.     # if address book      
  23.     elif begin_input=="address book":
  24.         while True:
  25.             print("Enter 'add', to add an adress.")
  26.             print("Enter 'delete', to delete all of your adresses.")
  27.             print("Enter 'view' to view you adresses.")
  28.             print("Enter 'quit' to leabe the program.")
  29.             user_input=input(": ")
  30.            
  31.             try:
  32.                 addresses=open("addresses.txt","r")
  33.             finally:
  34.                 addresses.close()
  35.            
  36.             # add address function
  37.             def add_address():
  38.                 try:
  39.                     append_addresses=open("addresses.txt","a")
  40.                     your_address=input(str("Your address, that you want to fix in the program: "))
  41.                     append_addresses.write(your_address+"\n")
  42.                     print("Address added to your file!")
  43.                 finally:
  44.                     append_addresses.close()
  45.            
  46.             # delete address function
  47.             def delete_addresses():
  48.                 try:
  49.                     deleting_addresses=open("addresses.txt","w")
  50.                     print("Deleting...")
  51.                 finally:
  52.                     deleting_addresses.close()
  53.            
  54.             # view address function
  55.             def view_addresses():
  56.                 try:
  57.                     viewing_addresses=open("addresses.txt","r")
  58.                     print("Your addresses: ")
  59.                     print(viewing_addresses.read())
  60.                 finally:
  61.                     viewing_addresses.close()
  62.  
  63.             # if user input = something
  64.             if user_input=="quit":
  65.                 print("Quitting...")
  66.                 breaking_loops=False
  67.                 break          
  68.             elif user_input=="add":
  69.                 add_address()
  70.            
  71.             elif user_input=="delete":
  72.                 delete_addresses()
  73.                
  74.             elif user_input=="view":
  75.                 view_addresses()
  76.                
  77.     # if my passwords
  78.     elif begin_input=="my passwords":
  79.         while True:
  80.             print("Enter 'add' to add a password.")
  81.             print("Enter 'delete' to delete.")
  82.             print("Enter 'view' to view your passwords.")
  83.             print("Enter 'quit' to leave the program.")
  84.             user_input1=input(": ")
  85.            
  86.             try:
  87.                 passwords=open("passwords.txt","r")
  88.             finally:
  89.                 passwords.close()
  90.                
  91.             # add password function
  92.             def add_password():
  93.                 try:
  94.                     append_passwords=open("passwords.txt","a")
  95.                     your_password=input(str("Your password, that you want to remember: "))
  96.                     append_passwords.write(your_password+"\n")
  97.                     print("Password added to your password list!")
  98.                 finally:
  99.                     append_passwords.close()
  100.            
  101.             # add delete function
  102.             def delete_passwords():
  103.                 try:
  104.                     deleting_passwords=open("passwords.txt","w")
  105.                     print("Deleting...")
  106.                 finally:
  107.                     deleting_passwords.close()
  108.            
  109.             # add view function
  110.             def view_passwords():
  111.                 try:
  112.                     viewing_passwords=open("passwords.txt","r")
  113.                     print("Your passwords: ")
  114.                     print(viewing_passwords.read())
  115.                 finally:
  116.                     viewing_passwords.close()
  117.                    
  118.             # if user_input1 = something
  119.             if user_input1=="quit":
  120.                 print("Quitting...")
  121.                 breaking_loops=False
  122.                 break
  123.            
  124.             elif user_input1=="add":
  125.                 add_password()
  126.                
  127.             elif user_input1=="delete":
  128.                 delete_passwords()
  129.                
  130.             elif user_input1=="view":
  131.                 view_passwords()
  132.    
  133.     else:
  134.         print("You probably entered something wrong.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement