Professor has us developing a traingle game, but he just tells us to read a book
ID: 3751645 • Letter: P
Question
Professor has us developing a traingle game, but he just tells us to read a book. Python for Everybody but it doesnt explain about this game and we're currently in chapter 4 but still no way to build a game.
This is the project is this >>>
You are asking to develop a “Triangle Guessing” game in Python for this assignment.
The program accepts the lengths of three (3) sides of a triangle as input from a player. To simplify the program, assume all the lengths are positive integers. The program output should indicate whether the triangle is a right triangle, an acute triangle, or an obtuse triangle.
Tips to help you for this assignment:
Make sure each side of the triangle is numerical value.
Check the triangle inequality. The sum of the lengths of any two sides of a triangle is greater than the length of the third side. If you take the three sides of a triangle and add them in pairs, the sum is greater than (not equal to) the third side. If that is not true, then it is not possible to construct a triangle with the given side lengths.
For any wrong input, tell the player what is wrong and asking to re-enter.
Allow a player to play multiple times, for example, using a while loop. Remind the player what input to stop the game.
Develop your game/program a user friendly one.
Document your program by adding comments:
Introduce/describe the program including the author, date, goal/purpose of the program
Document every variable used at the program even the name is meaningful
Explain/comment operation/activity/logic of your code. For example, “Checking whether the inputs are positive integers” and “Checking the validity the 3 lengths to see if they are able to form a triangle”
Testing your program for all possible input and every of the 3 possible triangles
Explanation / Answer
import random
smaller_Value = int(input("Enter the smaller number: "))
larger_value = int(input("Enter the larger_value number: "))
my_Num = random.randit(smaller_Value, larger_value)
counter = 0
while True:
counter += 1
if userNumber < my_Num:
print("Too small")
elif userNumber > my_Num:
print("Too large")
else:
print("Congratulations! You've got it in", counter, "tries!")
break
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.