Question: 1 - Write a Python class named Student with two attributes: student_id, student_name. Add a new attribute: student_class. Create a function to display all attributes
1 - Write a Python class named Student with two attributes: student_id, student_name. Add a new attribute: student_class. Create a function to display all attributes and their values in the student class. 2- Write a Python class named Rectangle constructed from length and width and a method that will compute the area of a rectangle. 3 - Write a Python class named Circle constructed from a radius and two methods that will compute the area and the perimeter of a circle. 4 - Follow the steps: a) Create a class, Triangle. Its _init_O method should take self, angle1, angle2, and angle3 as arguments. Make sure to set these appropriately in the body of the init_Omethod. b) Create a variable named number_of_sides and set it equal to 3 . c) Create a method named check_angles. The sum of a triangle's three angles is It should return True if the sum of self.angle1, self.angle2, and self.angle 3 is equal 180 , and False otherwise. d) Create a variable named my_triangle and set it equal to a new instance of your Triangle class. Pass it three angles that sum to 180 (e.g., 90,30,60). e) Print out my_triangle.number_of_sides and print out my_triangle.check_angles()
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
