Python Practicals - 2022 - 23 - Qs
Python Practicals - 2022 - 23 - Qs
1. Write a Python program to input your marks of five subjects (out of 100)
and find the average and grade from the given marks:
Given:
Grades
Average Marks Grades
91 - 100 A
81 – 90 B
71 - 80 C
60 - 70 D
48 - 59 E
Less than 48 F
2. Write a Python program to input an item name, it’s code (integer value)
and cost (floating number) to find the sale price of the item with given cost
and discount (%) as shown below:
Given
The item name should be of string type, code is of integer value and cost is
of floating number.
Also round off the sale price to whole number while printing the output.
Cost Price Discount
3000 - 6000 5%
6000 - 15000 10 %
15000 - 25000 20 %
Above 25000 30%
6. Write a Python program to calculate EMI for Amount, Period and Interest
from a user entered amount and time period.
Given: -
E = PR (1+ R) n / ((1+ R) n -1)
where E = EMI;
P = Principal Loan Amount;
R = Rate of interest per Anum., given rate as 0.96 per Anum
n = tenure of loan repayment in months.
7. Write a Python program to calculate tax - GST / Income Tax from a user
entered net price and cost.
Given: -
GST Amount = Net Price – Original Cost
GST Percentage = (GST Amount * 100)/ Original Cost
8. Write a Python program to find the sum of squares of the first 100 natural
numbers.
9. Write a Python program to print the first ‘n’ multiples of given number.
11.Write a program to input a number and count the occurrences of that number
in list. Generate the list by accepting five values from the user.
12. Write a program to accept values from the user up to a certain limit
entered by the user; if the number is even, then add it to a list.
13. Write a Python program to find the third largest and smallest number in a
list. Create the list by accepting values from the user up to a certain limit.
15. Write a menu driven program to perform the following. Use Library
functions.
a) At runtime add 5 elements (movie names) to a list and display it.
b) Sort the list and display the list before and after the sort.
c) Insert a new movie name at the desired location and display the
modified list.
d) Check the presence of a movie name in the given list. If present
display its position else display “Movie not found”.
The program should work as many times the user wants.
DICTIONARY
16. Write a Python program that asks the user to enter state names and their
capital to create a dictionary to store names of states and their capitals. Also
search and display the capital for a particular state.
17.Write a Python program to input roll numbers, students name, their total
mark (out of 500) and percentage calculated, to create a dictionary to store
names and marks and display all the details in a tabular form.
18.Write a Python program that asks the user to enter product names and prices.
Store all of these in a dictionary whose keys are the product names and
whose values are the prices. When the user is done entering products and
prices, allow them to repeatedly enter a product name and print the
corresponding price or message if the product is not in the dictionary.
19.Write a program to store item names and their price in a dictionary, delete
a particular item name from the dictionary. Also display dictionary after
deletion.
20.Write a Python program to input names of ‘n’ employees and their salary
details like basic salary, house rent and conveyance allowance. Calculate
total salary of each employee and display.
*******************