Advertisement
horozov86

My Calculator

Apr 26th, 2023
86
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.40 KB | None | 0 0
  1. def welcome():
  2.     return '''$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
  3. $   Welcome to Georgi Horozov Calculator   $
  4. $        Please select an option           $
  5. $                continue                  $
  6. $                                          $
  7. $                                          $
  8. $          Author: Georgi Horozov          $
  9. $           Sofia, Bulgaria 2023           $
  10. $                                          $
  11. $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$\n'''
  12.  
  13. def add(n1, n2):
  14.     return n1 + n2
  15.    
  16. def substract(n1, n2):
  17.     return n1 - n2
  18.    
  19. def multipyl(n1, n2):
  20.     return n1 * n2
  21.    
  22. def devide(n1, n2):
  23.     return n1 / n2
  24.    
  25. print(welcome())
  26.  
  27. while True:
  28.     choice = input("1. Add\n2. Substract\n3. Multiply\n4. Devide\n5. Exit\nEnter your choice: ")
  29.    
  30.     if choice == "5":
  31.         print("Thank you for using Georgi Horozov Calculator")
  32.         break
  33.     n1 = float(input("Enter first number: "))
  34.     n2 = float(input("Enter second number: "))
  35.    
  36.     if choice == "1":
  37.         print("The sum is: ", add(n1, n2), "\n")
  38.    
  39.     elif choice == "2":
  40.         print("The substract is: ", substract(n1, n2), "\n")
  41.        
  42.     elif choice == "3":
  43.         print("The multiply is: ", multiply(n1, n2), "\n")
  44.        
  45.     elif choice == "4":
  46.         print("The devide is: ", devide(n1, n2), "\n")
  47.    
  48.    
  49.     else:
  50.         print("Wrong choice!!!")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement