Python String Concepts
Python String Concepts
4. Explain the lifecycle of an object in Python. How does Python handle object destruction?
5. Write a Python program to create a class Student with instance variables usn, name, and marks.
Create two objects and display the details of the student who has the highest mark.
6. Write a Python program to create a class Employee with the attributes: empid, empname,
empnohrs, empbasic, emphra(%), empda(%), empit(%), and empgross. Implement methods to
calculate gross salary based on given conditions.
7. Develop a Python program to create a class Circle with a member radius and methods to:
- Accept the radius from the user
- Find the area of the circle
- Find the perimeter of the circle
- Display all details
8. Explain inheritance in Python with an example. How does a child class access parent class
methods?
11. What is operator overloading in Python? Explain with an example of overloading the `+` operator
for a user-defined class.
12. Write a Python program to overload the `>` (greater than) operator in a class.
14. Write a Python program to check the validity of age. Raise an exception if the entered age is
negative.
15. Write a Python program that accepts two numbers from the user and performs their division.
Handle exceptions for division by zero and invalid input.