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

2024-05-16 03:25:11 发布

您现在位置: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: ofthetobasebyvalueareavariable