【问题标题】:why does my code print this <function triangle_area at 0x7f82fa32c710> the perimeter of the triangle s<function triangle_perimeter at 0x7f82fa32c830>为什么我的代码打印这个 <function triangle_area at 0x7f82fa32c710> 三角形的周长 s<function triangle_perimeter at 0x7f82fa32c830>
【发布时间】:2022-12-18 14:18:20
【问题描述】:
def triangle_area(base, height):
\# This function should receive the base and height of a triangle as integers and return the area as a float.
area = base \* height // 2
return triangle_area

def triangle_perimeter(a,b,c):
\# This function should return the perimeter when 3 sides are provided.
perimeter = round(a+b+c)
return triangle_perimeter

def main():
base = int(input('Enter the base of the triangle: '))
Height = int(input('Enter the height of the triangle: '))
second = int(input('enter the second of the triangle: '))
third = int(input('Enter the third of the triangle: '))
print('the area of the triangle is: ' ,triangle_area)
print('the perimeter of the triangle is: ', triangle_perimeter)

我被卡住了,需要快速回答。如果有人可以帮助我,那就太好了。谢谢你。任何输入都非常有帮助或想法。

【问题讨论】:

    标签: python


    【解决方案1】:

    你应该给出这样的参数:

    print('the area of the triangle is: ' ,triangle_area(base, height))
    print('the perimeter of the triangle is: ', triangle_perimeter(base, second, third))
    

    【讨论】:

      猜你喜欢
      • 2022-07-18
      • 2017-02-27
      • 2013-10-20
      • 1970-01-01
      • 2022-11-17
      • 2023-01-23
      • 1970-01-01
      • 1970-01-01
      • 2020-03-20
      相关资源
      最近更新 更多