Lab Programming with Python
Lab Programming with Python
2. Write a program that makes use of trigonometric functions available in math module.
3. Write a program that will convert various temperatures.
a. Fahrenheit to Centigrade
b. Centigrade to Fahrenheit
4. Write a program that will find the roots of a quadratic equation: ax² + bx + c = 0
5. Write a program that demonstrate the usage of various String functions.
6. Write a program that will ask you to enter your name, through keyboard, and perform
following operations
a. Find the middle name
b. Find the last name (using string slicing)
c. Re-write the name with surname first.
7. Write a program to find out whether the integer entered by the user, through the
keyboard, is even or odd number.
8. Find out the youngest among Shyam, Dugu and Ishan whose ages are entered by the
user through keyboard.
9. Given three points (x1, y1), (x2, y2), (x3, y3), write a program to check all the three
points fall on one straight line.
10. Write a program that will print the odd numbers from n1 to n2 where the values of n1
and n2 are entered by the user.
11. Write a program to find the factorial value of a number entered by the user.
12. Write a program to print all prime numbers between n1 to n2 where the values of n1
and n2 are entered by the user.
13. Write a program to demonstrate basic operations on the list.
14. Write a program to demonstrate stack and queue operations using a list of numbers.
15. Write a program to ask the data of five students that contain name, roll number, age.
Sort the list based on roll number of the student. [Note: Use list of lists].
16. Write a program that will add two square matrices. The dimension and elements of
the matrices will be entered by the user.
17. Write a program to demonstrate basic operations on the tuple.
18. Store the data about the shares held by the user as tuples containing the following
information about shares: share name, cost price, number of shares, selling price.
Write a program to determine:
a. total cost of the portfolio
b. total amount gained or lost
19. Write a program to demonstrate basic operations on the set.
20. Create an empty set. Write a program that adds five student names to this set,
modifies one existing name, and deletes two names existing in it. [ask the user which
name to modify/delete].
21. Write a program to demonstrate basic operations on the dictionary.
22. Create a dictionary to store data (name, roll number) of N students. The key will be
the roll number of the student and the value contains the data of the student (in a list).
Write a program that asks the user to enter a name of a Student, search it in the
dictionary and print the data of the Student if it is available otherwise display an
appropriate message.
23. Write a program to demonstrate basic comprehensions on list, set and dictionary.
24.Write a program that will find x^n (x to the power of n) using a function. The function
receives the value of x, n and should return the value of x^n. [don’t use any mathematical
function].