This is the code i used but I don’t know how to make it show me the area for the first one before asking for the second set of values.

NumOfTri = eval(input("Enter the number of triangles to calculate the area: "))
Base1 = eval(input("Enter base of triangle: "))
Height1 = eval(input("Enter height of triangle: "))
for i in range(NumOfTri - 1):
base = eval(input("Enter base of triangle: "))
height = eval(input("Enter height of triangle: "))
area = base * height
print("The area of the triangle is: ", area)

NumOfTri = eval(input("Enter the number of triangles to calculate the area: "))
for i in range(NumOfTri):
base = eval(input("Enter base of triangle: "))
height = eval(input("Enter height of triangle: "))
area = base * height # must divide by 2, this is area of square.
print("The area of the triangle is: ", area)

basically you are on the right track, its just that you added some unnecessary code here. Also one thing to change is for i in range(NumOfTri-1)
You do not need to -1. its unnecessary
and the formula is base*height/2

Thank me later bud

Also you can change the eval for base and height to float to handle decimals @LamaTamr

Don’t give the whole answer as this is probably a school assignment. We’re only allowed to point them in the right direction, not give them the answers.

Even if he does submit my code to his/her teacher. She would probably question about it since its probably out of point somewhere.
since even if its a homework or sum there would be a set of questions to guide him/her.

Its not an assignment but it was a practice sheet for my programming exam. I was trying to figure out what I did wrong to fix it before my exam. But honestly good on u for looking out cuz I get why it looks that way XD

Thanks mate! I was tryna figure out what was wrong because I was going off some previous code examples I did which had the same premise but it wanted something completely different.

One other question. How do i get the “Done! Triangle Area program is finished” text to appear only after the n amount of triangles have been solved? I tried putting

print(“Done!..”)

at the end of the code, but it appears after the first one is solved.

NumOfTri = eval(input("Enter the number of triangles to calculate the area: "))
for i in range(NumOfTri):
base = eval(input("Enter base of triangle: "))
height = eval(input("Enter height of triangle: "))
area = base * height # must divide by 2, this is area of square.
print("The area of the triangle is: ", area)
print("Done! Triangle Area Program is finished")