Basics of Python
1. Write a Python program to compute the area and volume of a
cylinder given the radius and length.
2. Write a Python program to convert temperature from Celsius
to Fahrenheit.
3. Write a Python program that reads a number in feet, converts
it to meters, and displays the result. (Use 1 foot = 0.305 meters.
Test with 16.5 feet.)
4. Write a Python program that calculates the energy needed to
heat water from an initial temperature to a final temperature.
Use the formula:
Energy = weight × specific heat × change in temperature
Assume the specific heat of water is 4.186 J/g°C.
5. Write a program to input two numbers and determine which
of them is larger.
6. Write a program to input a number and determine whether it
is odd or even.
7. Write a program to determine if a student will have a result
based on:
○ Attendance must be at least 75%
○ Score must be at least 50
8. Write a program to input an integer and determine whether it
is zero, positive, or negative.
9. Write a program using a for loop to print numbers from 1 to
10.
10.Write a program to iterate over a string using a for loop.
11.Write a program to iterate over a list using a for loop.
12. Write a program to iterate over a tuple using a for loop.
13.Write a program to iterate over a sequence using an index.
14.Write a program to search for an item in a list using a for loop
with if-else.
15.Write a program to iterate using a while loop and print
numbers from 1 to 6.
16.Write a program using a while loop to print "Programming"
six times.
17.Write a program to search for a number in a list using a while
loop.
18.Write a program to print a star pattern using nested loops.
19.Write a program to print a 12 × 12 multiplication table.
20. Write a program to calculate the sum and average of the
first n integers.
21.Write a program to calculate the sum and average of n
user-entered numbers.
22. Write a program to calculate the factorial of a number.
23. Write a program to generate the first n terms of a Fibonacci
series.
24. Write a Python program to demonstrate a function that
displays a welcome message.
25. Write a program to generate the Fibonacci series using a
function.
26. Write an OOP program using class, constructor, and
method to display a message.
27.Create a class named Employer with attributes and a method
to display employer information.
28. Define a class named Smartphone with constructor and
method to describe the device.
29. Write an OOP program to calculate the sum of two
numbers using a class.
30. Write a Python program using a constructor to convert
Celsius to Fahrenheit.
31.Write an OOP program to calculate the area and volume of a
cylinder using a class.
32. Write an OOP program to calculate the energy needed to
heat water using the formula:
Q = M × (finalTemperature − initialTemperature) × 4184
33. Write a Python program to demonstrate single inheritance
using Animal and Dog.
34. Write a Python program to demonstrate inheritance using
Employee and Programmer to show salary and bonus.
35. Write a Python program to demonstrate multilevel
inheritance using a Calculation class.
36. Write a Python program using inheritance to calculate an
electricity bill.
37.Write a Python program using inheritance to calculate library
fine for overdue books.