Malaviya National Institute of Technology Jaipur
Department of Computer Science Engineering
Python Programming Lab
Lab-Midsem Examination
1. Write a Python program that performs the following tasks:
(a) Take two integer inputs from the user.
(b) Use all arithmetic operators (+, -, *, /, %) on the two integers and display the results.
(c) Using the results obtained from part (b), calculate the final grade of students as follows:
i. score ≥ 90 : ”A”
ii. score ≥ 80 : ”B”
iii. score ≥ 70 : ”C”
iv. score ≥ 60 : ”D”
2. Create a Python program where:
• The dictionary keys are of different data types (string, integer, tuple).
• The values include different data structures:
– A list
– A tuple
– A nested list (a list inside another list)
Perform the following tasks:
(a) Print the 1st and 2nd values from the nested list.
(b) Print the 0th key and its corresponding value(s).
(c) From the nested list:
• Remove the 0th index list (the first inner list).
• Append the removed list back at the end of the nested list.
• Print the length of the nested list after modification.
(d) Print the final form of the entire dictionary after performing the above operations.
***Best wishes***