This post has been de-listed
It is no longer included in search results and normal feeds (front page, hot posts, subreddit posts, etc). It remains visible only via the author's post history.
In this problem I am tasked with writing a program to find the area of a trapezoid. Can anyone tell me what this error means and how to fix it? I guess itโs something to do with the formatting of the area formula but I canโt figure out how to fix it. Thanks guys def problem1_7(): b1 = input("Enter the value of base 1: ") b2 = input("Enter the value of base 2: ") h = input("Enter the height: ") area = int((1/2)(b1 b2)h) print("The area of a trapezoid with bases",b1,b2,"and",h,"is",area )
problem1_7()
Enter the value of base 1: 3
Enter the value of base 2: 4
Enter the height: 8 Traceback (most recent call last):
File "<ipython-input-72-45c1a3480d6b>", line 1, in <module> problem1_7()
File "<ipython-input-71-3ff2361ff4f6>", line 5, in problem1_7 area = int((1/2)(b1 b2)h)
TypeError: can't multiply sequence by non-int of type 'float'
Subreddit
Post Details
- Posted
- 5 years ago
- Reddit URL
- View post on reddit.com
- External URL
- reddit.com/r/learnpython...