repl.it
@Bookie0/

Calculator

Python

No description

fork
loading
Files
  • main.py
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import time


print ("Calculator")
c = True
while c == True:
  num1 = int(input(">>>"))
  num2 = int(input(">>>"))
  print ("m = multiplication")
  print ("d = division")
  print ("a = addition")
  print ("s = substraction")
  mode = input(">>>")
  if mode == "m":
    print ((num1), "*", (num2), "=", (num1 * num2))
    time.sleep(3)
    q1 = input("Return to calculator menu?   ")
    if q1 == "yes":
      A = False
    else:
      #go back to main menu
  elif mode == "d":
    print ((num1), "/", (num2), "=", (num1 / num2))
    time.sleep(3)
    q2 = input("Return to calculator menu?   ")
    if q2 == "yes":
      A = False
    else:
      #go back to main menu 
  elif mode == "a":
    print ((num1), "+", (num2), "=", (num1 + num2))
  elif mode == "s":
    print ((num1), "-", (num2), "=", (num1 - num2))
  else:
    print ("Error. Please try again.")
    time.sleep(3)
    c = True
  
  
  
  
  
?