Advertisement
AntoniiaG

Untitled

Dec 11th, 2023
692
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1.  
  2. z = 1
  3. while z < 2:
  4.     select = input("Enter:\n"
  5.                 "+\n"
  6.                 "-\n"
  7.                 "*\n"
  8.                 "/\n"
  9.                 "\n")
  10.    
  11.     if select == "+" or select == "-" or select == "*" or select == "/":
  12.         z += 1
  13.    
  14.     def addition():
  15.         a = float(input("a = "))
  16.         b = float(input("b = "))
  17.         c = a + b
  18.         print("The sum is: ", c)
  19.  
  20.     def subtraction():
  21.         a = float(input("a = "))
  22.         b = float(input("b = "))
  23.         c = a - b
  24.         print("The sum is: ", c)
  25.  
  26.     def multiplication():
  27.         a = float(input("a = "))
  28.         b = float(input("b = "))
  29.         c = a * b
  30.         print("The sum is: ", c)
  31.  
  32.     def division():
  33.         a = float(input("a = "))
  34.         b = float(input("b = "))
  35.         c = a / b
  36.         print("The sum is: ", c)
  37.  
  38.     if select == "+":
  39.         addition()
  40.     elif select == "-":
  41.         subtraction()
  42.     elif select == "*":
  43.         multiplication()
  44.     elif select == "/":
  45.         division()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement