如何在结果中添加度量单位?

2022-09-28 21:22:40 发布

您现在位置:Python中文网/ 问答频道 /正文

# assign the value 12 to the base
base = 12

# assign the value 16 to the height
height = 16

# assign the results of the operation to the variable area
# the operation multiplies base by height

# assign the area of a triangle formula
area = (1/2) * (base*height)

# print the value of triangle area
print(area)

Tags: ofthetobasebyvalueareavariableoperationresultsprinttriangleheightassignmultiplies