# [Tutor] Looks like Giant Calc is a bust.

Nathan Pinno falcon3166 at hotmail.com
Sun Jul 10 05:16:50 CEST 2005

```Hey all,

The Giant Calculator runs now, just not as I want it to. I can't seem to get it past the main menu. Here is the code:

# This program is designed as a big calculator with functions.

# This first bunch of code is for the various menus. I decided to divide the calculations into seperate sub-menus,
#so that the main menus would not be that long.
option = 0
a = 0
b = 0
temp_option = 0
formula_option = 0

print "1) Calculate"
print "2) Shapes"
print "3) Temperature"
print "4) Formulas"
print "5) Quit"
option = input("What option would you like:" )

print "2) Subraction"
print "3) Multiplication"
print "4) Division w/o remainder"
print "5) Division with remaider"
print "6) Exponation"
print "7) Square roots"
print "8) Back to the previous menu."
a = input("What option would you like:" )

print "Important: The figure that is used for pi is 3.14."
print "1) Squares"
print "2) Circles"
print "3) Rectangles"
print "4) Triangles"
print "5) Cones"
print "6) Cylinders"
print "7) Semicircles"
b = input("What option would you like?" )

print "1) Convert degrees Kevins to degrees Celsius"
print "2) Contvert Fahrenheit to Celsius"
print "3) Convert Celsius to Fahrenheit"
print "4) Convert Celsius to Kelvins"
print "5) Convert Kelvins to Fahrenheit"
print "6) Convert Fahrenheit to Kelvins"
temp_option = input("Choice: ")

print "1) Interest"
print "2) Distance"
print "3) Uniform motion"
print "4) Momentum"
print "5) Uniformly accelerated motion"
print "6) Falling bodies"
print "7) Weight"
fourmula_option = input("Choice: ")

#Code for main part of program.
print "The Giant Calculator"
print
print "Copyright 2005 Written and debugged by Nathan Pinno"
print
if option == 1:
if a == 1:
X = input("First number:" )
Y = input("Second number:" )
print X, "+", Y, "= ",X + Y
elif a == 2:
X = input("First number:" )
Y = input("Second number:" )
print X, "-", Y, "= ",X - Y
elif a == 3:
X = input("First number:" )
Y = input("Second number:" )
print X, "*", Y, "= ",X * Y
elif a == 4:
X = input("First number:" )
Y = input("Second number:" )
if Y == 0:
print "Division by zero ot allowed!"
Y = input("Second number:" )
else:
print X, "/", Y, "= ",X / Y
elif a == 5:
X = input("First number:" )
Y = input("Second number:" )
if Y == 0:
print "Division by zero ot allowed!"
Y = input("Second number:" )
else:
print X, "/", Y, "= ",X / Y," R ", X % Y
elif a == 6:
X = input("First number:" )
Y = input("Power:" )
print X, "**", Y, "= ",X**Y
elif a == 7:
X = input("Number to be squared:" )
print "The square root of", X, " = ",X**0.5
elif a == 8:
else:
print "That's not an option. Try again."
a = input("What option would you like:" )
elif option == 2:
if b == 1:
print "1) Circumference"
print "2) Area"
op = input("Choice: ")
if op == 1:
side = input("Side: ")
print "Circumference = ",4*side
elif op == 2:
side = input("Side: ")
print "Area = ",side**2
elif op == 3:
else:
print "That's not an option."
op = input("Choice: ")
elif b == 2:
print "1) Circumference"
print "2) Area"
d = input("Choice: ")
if d == 1:
diameter = input("Diameter: ")
print "The circumference of the circle is ",diameter*3.14
elif d == 2:
print "The area of the circle is ",3.14*(radius**2)
elif d == 3:
else:
print "That's not an option."
d = input("Choice: ")
elif b == 3:
print "1) Area"
print "2) Perimeter"
g = input("Choice: ")
if g == 1:
base = input("Base: ")
altitude = input("Altitude: ")
print "The area of the rectangle is: ",base*altitude
elif g == 2:
base = input("Base: ")
altitude = input("Altiutude: ")
print "The perimeter of the rectangle is: ",(2*base)+(2*altitude)
elif g == 3:
else:
print "That's not an option."
g = input("Choice: ")
elif b == 4:
print "1) Right Triangles - Pygathorean Theorum"
print "2) Perimeter"
print "3) Area"
e = input("Choice: ")
if e == 1:
sidea = input("Side A: ")
sideb = input("side B: ")
print "The hypotenuse's length is: ",((sidea**2)+(sideb**2))**0.5
elif e == 2:
sidea = input("Side A: ")
sideb = input("Side B: ")
sidec = input("Side C: ")
print "The Perimeter of the triangle is: ",sidea+sideb+sidec
elif e == 3:
base = input("Base: ")
height = input("Height: ")
print "The area of the triangle is: ",1/2*base*height
elif e == 4:
else:
print "That's not an option! Try again."
e = input("Choice: ")
elif b == 5:
print "The base and circumference of a cone can be found with the circle formulas, so they aren't found here."
print "1) Lateral Area"
print "2) Total Area"
print "3) Volume"
opt = input("Choice: ")
if opt == 1:
sl = input("Slant height: ")
print "The Lateral Area is: ",1/2*(2*3.14*r)*sl
elif opt == 2:
sl = input("Slant height: ")
print "The total area is: ",1/2*(2*3.14*r)*sl+(3.14*(r**2))
elif opt == 3:
height = input("Height: ")
print "The volume is: ",1/4*(3.14*(r**2))*height
elif opt == 4:
else:
print "That's not an option"
opt = input("Choice: ")
elif b == 6:
print "1) Lateral Area"
print "2) Total Area"
print "3) Volume"
g = input("Choice: ")
if g == 1:
height = input("Height: ")
print "The Lateral Area is: ",(2*3.14*r)*height
elif g == 2:
height = input("Height: ")
print "The Total Area is: ",((2*3.14*r)*height)+(2*(3.14*(r**2)))
elif g == 3:
height = input("Height: ")
print "The volume is: ",(3.14*(r**2))*height
elif g == 4:
else:
print "That is not an option!"
g = input("Choice: ")
elif b == 7:
print "1) Arc Length"
print "2) Area"
h = input("Choice: ")
if h == 1:
diam = input("Diameter: ")
print "The arc length is: ",(3.14*diam)/2
elif h == 2:
print "The area is: ",(3.14*(r**2))/2
elif h == 3:
else:
print "Sorry, incorrect entry. Please try again."
h = input("Choice: ")
elif b == 8:
else:
print "Sorry, not an option."
elif option == 3:
if temp_option == 1:
print "Convert degrees Kelvin to degrees Celsius."
k = input("Degrees Kelvin: ")
print k-273.16," degrees Celsius"
elif temp_option == 2:
print "Convert Fahrenheit to Celsius"
f = input("Degrees Fahrenheit: ")
print 5/9*(f-32)," degrees Celsius"
elif temp_option == 3:
print "Convert Celsius to Fahrenheit"
c = input("Degrees Celsius: ")
print (9/5*C)+32," degrees Fahrenheit"
elif temp_option == 4:
print "Convert degrees Celsius to degrees Kelvin"
c = input("Degrees Celsius: ")
print c+273.16," degrees Kelvin"
elif temp_option == 5:
print "Convert degrees Kelvin to Fahrenheit"
k = input("Degrees Kelvin: ")
print ((k-273.16)*9/5)+32," degrees Fahrenheit"
elif temp_option == 6:
print "Convert Fahrenheit to degrees Kelvin"
f = input("Degrees Fahrenheit: ")
print (5/9*(f-32))+273.16," degrees Kelvin"
elif temp_option == 7:
else:
print "That's not an option. Please try again"
elif option == 4:
if formula_option == 1:
p = input("Principal: ")
r = input("Rate as a decimal: ")
t = input("Time in years: ")
print "Interest: ",p*r*t
elif formula_option == 2:
r = input("Rate: ")
t = input("Time: ")
print "Distance: ",r*t
elif formula_option == 3:
v = input("Velocity: ")
t = input("Time: ")
print "Uniform motion: ",v*t
elif formula_option == 4:
m = input("Mass: ")
v = input("Velocity: ")
print "Momentum: ",m*v
elif formula_option == 5:
as = input("Acceleration speed: ")
t = input("Time: ")
print "Uniformly accelerated motion: ",1/2*as*t
elif formula_option == 6:
gravity = input("Constant acceleration due to gravity: ")
t = input("Time: ")
print "Distance covered by falling body: ",1/2*gravity*(t**2)
elif formula_option == 7:
m = input("Mass: ")
gravity = input("Gravity: ")
print "Weight: ",m*gravity
elif formula_option == 8:
else:
print "That is not an option."
elif option == 5:
print "Goodbye!"
else:
print "That is not an option. Please choose an option from the menu."