Python Programming – Practical / Theory Questions
1. What is Python programming language? Discuss different types of tokens with examples.
2. Discuss the structure of a Python program with an example.
3. Write a program to find addition, subtraction, multiplication and division of two numbers.
4. Write a program to swap two numbers:
a) Using third variable
b) Without using third variable
5. What are data types? Discuss various types of data types with the help of a program.
Illustrate the use of type() function.
6. What do you mean by operators? Write a program to show the use of different types of
operators.
7. Write a program to print whether entered number is odd or even using if statement.
8. Write a program to enter age of a person and check whether the person is eligible for vote
or not using if else statement.
9. Write a program to print grade of student according to marks obtained using elif
statement.
10. Write a program to calculate multiplication of a number using for loop.
11. Write a program to generate the following patterns:
i) *
**
***
****
*****
ii) 1
12
123
1234
12345
12. Write a program to generate Fibonacci series.
13. Write a program to calculate sum of digits of a number using while loop.
14. Write a program to simulate a simple menu-driven program that allows the user to
choose from multiple options and perform corresponding tasks.
15. Write a program create a list and then modify and access the elements of a list.
16. Write a program to find sum of elements of a list and print second largest element.
17. Write a program to show the concept of slicing in list and tuple.
18. Write a program to convert a tuple to a list and list to a tuple.
19. Write a program to create a dictionary to find books from it in the range given by the
user. Print all the books with prices as well.
20. Write a program to show the use of functions.
21. Write a program to illustrate various inbuilt Python functions.
22. Write a program to find factorial of a number using recursion.
23. Write a program to create a package with two modules and import them in a program.
24. Write a program to illustrate the concept of exception handling using try, catch and
finally blocks.
25. Write a program to open, read, write and close a file.
26. Write a program to perform basic mathematical functions by importing NumPy.
27. Write a program to create and print a data frame in Pandas.