Programming_Exercises_Aligned
Programming_Exercises_Aligned
1. Write a program to reverse the digits of a given number and add it to the original.
2. Write a program using a while loop that asks the user for a number and prints
3. Write a program to calculate a student's result based on two examinations, one sports event,
5. Write a program to prepare a grocery bill. Enter the name of the items purchased, quantity,
6. Write a program that shows how to return multiple values from a function.
7. A string is given. Slice it into two parts: the first half and the second half.
If the string has an odd length, the second half will have one more character than the first half.
- Input:
- The first line contains an integer n, representing the number of operations.
- Output:
10. Write a program to store Fibonacci numbers in a list and sum even terms.
- Manage an inventory system. Inventory items will be stored as tuples (item name, price).
13. Write a program to unzip a list of tuples into individual lists and convert them into a dictionary.
14. Write a program to use split and join methods in a string and trace a birthday with a dictionary.
- Manage the product catalog for an e-commerce website. The catalog needs to store:
- Operations:
Use character frequency to infer the file type (e.g., Python, C, or text).
18. Write a program to compute the number of characters, words, and lines in a file.
- Robot class.
22. Write a program to demonstrate built-in functions to check, get, set, and delete class attributes.
24. Create a Person class with attributes name and age. Create a Student class that
25. Create a Shape class with methods like area() and perimeter(). Derive Circle,
Rectangle, and Triangle classes for specific calculations.
26. Use constructors (__init__()) in both parent and child classes. Demonstrate how the child class
initializes both its own attributes and inherited attributes using super().
27. Create a program where the child class overrides a method of the parent class (e.g.,
display_details()).
28. Overload operators like + or * in a class to perform custom operations (e.g., adding two Vector
objects).
29. Create a base class Product and child classes Electronics, Clothing, and Grocery.
30. Create a base class Transport and subclasses Car, Bus, and Bicycle.