Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def home():
- print "Welcome! Please enter the function you desire: "
- function = raw_input()
- if function == '+':
- return add()
- if function == "/":
- return div()
- if function == "*":
- return mul()
- if function == "-":
- return sub()
- else:
- print "Invalid character"
- return home()
- def add():
- print "Enter 1st number"
- a = int(raw_input())
- print "Enter 2nd number"
- b = int(raw_input())
- c = a + b
- print "The sum is",c
- return home()
- def div():
- print "Enter 1st number"
- a = float(raw_input())
- print "Enter 2nd number"
- b = float(raw_input())
- c = a / b
- print "The quotient is", (c)
- return home()
- def mul():
- print "Enter 1st number"
- a = int(raw_input())
- print "Enter 2nd number"
- b = int(raw_input())
- c = a * b
- print "The product is", c
- return home()
- def sub():
- print "Enter 1st number"
- a = int(raw_input())
- print "Enter 2nd number"
- b = int(raw_input())
- c = a - b
- print "The difference is", c
- return home()
Advertisement
Add Comment
Please, Sign In to add comment