| 1 |
ninoborges |
8 |
# Area calculation program
|
| 2 |
|
|
print "Welcome to the Area calculation program"
|
| 3 |
|
|
print "---------------------------------------"
|
| 4 |
|
|
print
|
| 5 |
|
|
|
| 6 |
|
|
# Print out the menu:
|
| 7 |
|
|
print "Please select a shape:"
|
| 8 |
|
|
print "1 Rectangle"
|
| 9 |
|
|
print "2 Circle"
|
| 10 |
|
|
|
| 11 |
|
|
# Get the user's choice:
|
| 12 |
|
|
shape = input("> ")
|
| 13 |
|
|
|
| 14 |
|
|
# Calculate the area:
|
| 15 |
|
|
if shape == 1:
|
| 16 |
|
|
height = input("Please enter the height: ")
|
| 17 |
|
|
width = input("Please enter the width: ")
|
| 18 |
|
|
area = height*width
|
| 19 |
|
|
print "The area is", area
|
| 20 |
|
|
else:
|
| 21 |
|
|
radius = input("Please enter the radius: ")
|
| 22 |
|
|
area = 3.14*(radius**2)
|
| 23 |
|
|
print "The area is", area
|