Q.1. Write a program that accepts the lengths of three sides of a triangle as inputs. The program output should indicate whether or not the triangle is an equilateral triangle.
Q.2. Write a program that accepts the lengths of three sides of a triangle as inputs. The program output should indicate whether or not the triangle is a right triangle. Recall from the Pythagorean theorem that in a right triangle, the square of one side equals the sum of the squares of the other two sides.
Q.3. Modify the guessing-game program of Section 3.5 so that the user thinks of a number that the computer must guess. The computer must make no more than the minimum number of guesses.
Please Use python 3.7
1)
def checkTriangle(a, b, c):
if (a + b <= c) or (a + c <= b) or (b + c <= a) :
print("Not a triangle")
else:
if(a==b and b==c):
print("equilateral triangle")
else:
print("trinagle but not equilateral")
2)
def checkTriangle(a, b, c):
if (a + b <= c) or (a + c <= b) or (b + c <= a) :
print("Not a triangle")
else:
if(a*a + b*b == c*c or a*a + c*c == b*b or c*c + b*b == a*a):
print("right angled triangle")
else:
print("trinagle but not right andgled trianlge")
3) no idea about section 3.5
Get Answers For Free
Most questions answered within 1 hours.