如何通過從用戶輸入中收集矩形的高度和寬度,計算區域並顯示結果,來編寫計算矩形區域的程序?你怎麼用一個長方體的體積來做呢?我的代碼到目前爲止:(我剛剛開始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