You are on page 1of 2

Python Lab Questions

1. Write a program to enter two integers, two floating numbers and then perform all arithmetic
operations on them.
2. In this scenario, two friends are eating dinner at a restaurant. The bill comes in the amount of
547.28. The friends decide to split the bill evenly between them, after adding 15% tip for the
service. Calculate the tip, the total amount to pay, and each friend's share, then output a
message saying "Each person needs to pay: " followed by the resulting number.
3. This code is supposed to take two numbers, divide one by another so that the result is equal to
1, and display the result on the screen. Write the code.
4. Write a program that receives a name, then returns a greeting based on whether or not that
name is "Taylor".
5. Write a program to check the no is odd or even
6. Write a program using bitwise operator
7. Write a program to find the largest no out of 2 numbers.
8. Write a program to find the largest no out of 3 numbers.
9. Find odd no, even no
10. Write a program to take 5 subjects marks, and compute total, average and grade based on the
marks.
11. Write a program to input any choice and to implement the following.
Choice Find
1. Area of square
2. Area of rectangle
3. Area of triangle
12. Write a program using logical operator
13. Write a program to check whether a number is an Armstrong number or not.
14. Write a program to print the sum of all the primes between two ranges.
15. Write a program to swap two strings.
16. Write a program to find whether the year is a leap year or not.
17. Write a menu driven program to accept two strings from the user and perform the various
functions using user defined functions.
18. Write a program to find smallest and largest number in a list
19. Create a dictionary whose keys are month names and whose values are the number of days in
the corresponding months.  Ask the user to enter a month name and use the dictionary to tell
them how many days are in the month.  Print out all keys in the alphabetically order  Print
out all the months with 31 days  Print out the key value pairs sorted by number of days in
each month
20. Make a list of first 10 letters of the alphabet, then use the slicing to do the following
operations:  Print the first 3 letters of the list  Print any 3 letters from the middle Print the
letter from any particular index to the end of the list
21. Write a program that scans an email address and forms a tuple of user name and domain.
22. Write a program that uses a user defined function that accepts name and gender (as M for
Male, F for Female) and prefixes Mr./Ms. on the basis of the gender.
23. Write a program to print the Fibonacci series using recursion
24. Write a program that defines a function large in a module which will be used to find larger of
two values and called from code in another module
25. Write a program to know the cursor position and print the text according to specifications
given below:
a. Print the initial position
b. Move the cursor to 4th position
c. Display next 5 characters
d. Move the cursor to the next 10 characters
e. Print the current cursor position
f. Print next 10 characters from the current cursor position
26. Create a binary file with roll number, name and marks. Input a roll number and perform the
following operations:
a. update the marks.
b. Delete the record
c. Display the record
d. Append the record
e. Search the record
27. Write a program to Create a CSV file by entering user-id and password, read and search the
password for given user id

You might also like