PLS BEFORE YOU BEGIN IF YOU KNOW YOU ARE NOT GOING TO COMPLETE ALL 3 QUESTIONS J
ID: 3870435 • Letter: P
Question
PLS BEFORE YOU BEGIN IF YOU KNOW YOU ARE NOT GOING TO COMPLETE ALL 3 QUESTIONS JUST ALLOW IT FOR ANOTHER PERSON. I DO NOT WANT UNCOMPLETED WORK DONE.
PLEASE USE THE PYTHON PROGRAMMING LANGUAGE FOR THIS QUESTION. answer all questions, pleasSSSSSSSSSSSSSSSE
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.
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.
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.
Explanation / Answer
Program to find whether the triangle is equilateral or not :
print("Input lengths of the triangle sides: ")
x = int(input("x: "))
y = int(input("y: "))
z = int(input("z: "))
if x == y == z:
print("Equilateral triangle")
elif x != y != z:
print("Scalene triangle")
else:
print("isosceles triangle")
2.
a, b, c, x = 0, 0, 0, 0
for i in xrange(3):
x = raw_input(" enter a side >> ")
if i == 0:
a = int(x)**2
elif i == 1:
b = int(x)**2
elif i == 2:
c = int(x)**2
if a + b == c:
print "the triangle is a right triangle."
else:
print "the triange is NOT a right triangle."
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.