#coding=utf-8
# Area calculation program
print ("Welcome to the Area calculation program")
print ("*********************************")
print
# Print out the menu:
print ("Please select a shape:")
print ("1 Rectangle")
print ("2 Circle")
#Get the user's choice: 注意str->int
shape = int(input("> "))
#Calculate the area:
if shape == 1:
height = int(input("Please enter the height: "))
width = int(input("Please enter the width: "))
area = height *width
print ("The area is ", area)
elif shape == 2:
radius = int(input("Please enter the radius: "))
area = 3.14 * (radius**2)
print ("The area is ", area)
else:
print ("Input is out of range,please re-enter.")
阅读(1872) | 评论(0) | 转发(0) |