Quiz!
Homework (Hacks)
- Write pseudocode to determine if a student passes a class based on their exam scores and attendance using nested conditionals.
- Write a python segment to decide the shipping cost based on the weight of a package and the delivery speed chosen (standard or express) using nested conditionals.
- Write a python segment to have different ticket prices for different ages, with a discount for students
Challenge Hack
Write a program that helps a user determine the type of triangle based on the lengths of its sides. The program should prompt the user to input three positive numbers representing the sides of a triangle. Your task is to use nested conditionals to check the following:
First, verify if the three sides can form a valid triangle (hint: the sum of any two sides must be greater than the third side). If it’s a valid triangle, further classify it into one of the following categories:
- Equilateral Triangle: All sides are equal.
- Isosceles Triangle: Two sides are equal.
- Scalene Triangle: No sides are equal. If the sides do not form a valid triangle, the program should display an appropriate message.
Requirements: Use nested conditionals to handle the logic for checking the type of triangle. Include input validation to ensure the user enters positive numbers.
Need Help?
Here’s some solutions.