0% found this document useful (0 votes)
12 views1 page

Python Class and Object Examples

Uploaded by

mobsmokieop
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views1 page

Python Class and Object Examples

Uploaded by

mobsmokieop
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming Questions - Classes and

Objects

1. Write a Python program to create a class representing a Book. Include attributes like title, author,
and price. Create an object of this class and print its details.

2. Write a Python program to create a class representing a Bank Account. Include methods for
deposit and withdrawal. Create an object and test all the methods.

3. Write a Python program to create a class representing a Circle. Include methods to calculate
area and perimeter. Create an object and display the results.

4. Write a Python program to create a class representing a Student. Include methods to add marks
and calculate the average. Create multiple student objects and compare their averages.

5. Write a Python program to create a class representing a Car. Include attributes like brand, model,
and year, and a method to display full details.

6. Write a Python program to create a class representing an Employee. Include attributes like
name, salary, and department, and methods to give a raise and display details.

7. Write a Python program to create a class representing a Rectangle. Include methods to calculate
area and perimeter. Create two rectangle objects and compare their areas.

8. Write a Python program to create a class representing a Laptop. Include attributes like brand,
model, and RAM, and a method to display configuration.

9. Write a Python program to create a class representing a Movie. Include attributes like title,
director, and budget, and a method to display all details.

10. Write a Python program to create a class representing a Temperature. Include methods to
convert from Celsius to Fahrenheit and vice versa.

You might also like