python编程求长方形的面积_如何用PYTHON计算出矩形的面积

1

打开JUPTER NOTEBOOK,新建一个PY文档。

python编程求长方形的面积_如何用PYTHON计算出矩形的面积_第1张图片

2

width = 5

length = 6

size = width * length

print(size)

定义三个变量,然后直接打印最后一个变量,这是一种方法。

python编程求长方形的面积_如何用PYTHON计算出矩形的面积_第2张图片

3

width = input("Please input the width: ")

length = input("Please input the width: ")

size = width * length

print(size)

也可以用INPUT,但是要

你可能感兴趣的:(python编程求长方形的面积)