如何通过从用户输入中收集矩形的高度和宽度,计算区域并显示结果,来编写计算矩形区域的程序?你怎么用一个长方体的体积来做呢?我的代码到目前为止:(我刚刚开始python)如何在python 3.3.4中编写一个程序来计算矩形区域?
shape = input("> ")
height = input("Please enter the height: ")
width = input("please enter the width: ")
area = [height*width]
print ("The area is", 'area')
但我收到无效的语法。
嗨!什么是确切的错误?例如,它是否给出了有关错误的可用建议? –
“形状”背后有什么打算? – Nabla