代码拉取完成,页面将自动刷新
# Author: PrajaktaSathe
# Program to calculate the area of - square, rectangle, circle, and triangle -
shape = int(input("Enter 1 for square, 2 for rectangle, 3 for circle, or 4 for triangle: "))
if shape == 1:
side = float(input("Enter length of side: "))
print("Area of square = " + str(side**2))
elif shape == 2:
l = float(input("Enter length: "))
b = float(input("Enter breadth: "))
print("Area of rectangle = " + str(l*b))
elif shape == 3:
r = float(input("Enter radius: "))
print("Area of circle = " + str(3.14*r*r))
elif shape == 4:
base = float(input("Enter base: "))
h = float(input("Enter height: "))
print("Area of rectangle = " + str(0.5*base*h))
else:
print("You have selected wrong choice.")
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。