I am not sure what am I supposed to assign for my while loop to work at the bottom. Please help me to understand what I am doing wrong. Below is my code and I have highlighted my main module. I know that is where the problem is.
Andy
Andy
Code:
from math import *
def menu():
print "\nSlect one of the following:"
print "1. Calculate Area of Rectangle"
print "2. Calculate Area of Circle"
print "3. Quit"
menuSel=input("Please enter your selection: ")
while menuSel!=1 and menuSel!=2 and menuSel!=3:
menuSel=input("Please re-enter a valid selection of 1, 2, or 3: ")
return menuSel
def rectangle():
print "You have chosen a rectangle."
b=input("enter base : ")
h=input("enter height:")
print "The area is ", b*h
return
def circle():
print "You have chosen a circle."
r=input("enter radius: ")
print "The area is ",pi*r**2
return
[B]def main():
choice = menu()
while menuSel!=3:
if menuSel==1:
rectangle()
elif menuSel==2:
circle()
menu()
return[/B]
main()
raw_input("\nPress enter to exit.")
Comment