These projects must be done in the latest version of IDLE:
- 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.
- 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.
- Modify the guessing-game program of Section 3.5, listed below, 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.
(Code is as follows)
import random smaller = int(input("Enter the smaller number: ")) larger = int(input("Enter the larger number: ")) myNumber = random.randit(smaller, larger) count = 0 while True: count += 1 if userNumber < myNumber: print("Too small") elif userNumber > myNumber: print("Too large") else: print("Congratulations! You've got it in", count, "tries!") break