Here's what I'm doing.
#Main screen for Python Math
def main():
import os
import time
import basic
os.system("clear")
print ("Welcome to Python Math")
print ("")
time.sleep(1)
print ("[1] Basic Math")
print ("[2] Advanced Math")
print ("[3] Exit")
print ("")
a = input("Please chose an option: ")
if a == 1:
basic.basic()
if a == 3:
exit()
That's the main screen to chose whether or not to go into the basic or advanced. Im making the advanced later.
#basic math
def basic():
import os
import time
import main
import math
os.system("clear")
print ("Welcome to Python Math")
print ("")
time.sleep(1)
print ("[1] 2 Digit Addition")
print ("[2] 2 Digit Subtraction")
print ("[3] 2 Digit Multiplication")
print ("[4] 2 Digit Division")
print ("[5] 3 Digit Addition")
print ("[6] 3 Digit Subtraction")
print ("[7] 3 Digit Multiplication")
print ("[8] 3 Digit Division")
print ("[9] Return")
print ("")
time.sleep(3)
a = input("Chose which function to use: ")
if a == 1:
math.add()
if a == 2:
math.sub()
if a == 3:
math.mult()
if a == 4:
math.div()
if a == 5:
math.addtwo()
if a == 6:
math.subtwo()
if a == 7:
math.multtwo()
if a == 8:
math.divtwo()
if a == 9:
main.main()
That's the script when you go to the basic screen where you chose the math problem to do.
#python addition script
def add():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
print "Your answer is: ",(a+b)
#python subtraction script
def sub():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
print "Your answer is: ",(a-b)
#python multiplication script
def mult():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
print "Your answer is: ",(a*b)
#python division script
def div():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
print "Your answer is: ",(a/b)
#python addition script
def addtwo():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
c = float(raw_input("Enter the third number: "))
print "Your answer is: ",(a+b+c)
#python subtraction script
def subtwo():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
c = float(raw_input("Enter the third number: "))
print "Your answer is: ",(a-b-c)
#python multiplication script
def multtwo():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
c = float(raw_input("Enter the third number: "))
print "Your answer is: ",(a*b*c)
#python division script
def divtwo():
a = float(raw_input("Enter the first number: "))
b = float(raw_input("Enter the second number: "))
c = float(raw_input("Enter the third number: "))
print "Your answer is: ",(a/b/c)
Thats the math for all the basic problems.
#Python Start
import main
main.main()
That's the start up. I have no idea how to make it simpler.