repl.it
@vahrammkhitarya/

FrenchUsableRam

Python 2.7

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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import time

def Goodbye():
  print "thank you for using"
  time.sleep(1)
  print "1) Yes "
  time.sleep(0.6)
  print "2) No "
  Question = raw_input("try again?")
  if Question == "1":
    Hello()
  elif Question == "2":
    print "Ok"

def add(a,b):
  print a, "+", b, "=", a + b
    
def sub(a,b):
  print b, "-", a, "=", b - a
    
def mul(a,b):
  print a, "*", b, "=", a * b
    
def div(a,b):
  print a, "/", b, "=", a / b

def menu():
    time.sleep(2)
    print "you can use following commands:"
    print " "
    print "1) + summing"
    time.sleep(0.6)
    print "2) - minusing "
    time.sleep(0.6)
    print "3) x multiplying "
    time.sleep(0.6)
    print "4) / Divinding "
    time.sleep(0.6)
    print "5) leave "
    print " "
    time.sleep(0.8)
    return input ("choose ")

print ("Welecome to vahram's calculator")
def Hello():   
  loop = 1
  choice = 0
  while loop == 1:
      choice = menu()
      if choice == 1:
          add(input("first num: "),input("second num: "))
          loop = 0
      elif choice == 2:
          sub(input("first num: "),input("second num: "))
          loop = 0
      elif choice == 3:
          mul(input("first num: "),input("second num: "))
          loop = 0
      elif choice == 4:
          div(input("first num: "),input("second num: "))
          loop = 0
      elif choice == 5:
          loop = 2
      elif choice > 5:
        try_again()
      
        
def try_again():
  print "wrong num" 
  time.sleep(2)
  print "try again "
  time.sleep(0.6)
  print "3"
  time.sleep(1)
  print "2"
  time.sleep(1)
  print "1"
  time.sleep(1)

Hello()
Goodbye()
Fetching token
?