0% found this document useful (0 votes)
2 views3 pages

Python Practical Assignment

The document outlines a Python practical assignment consisting of various programming tasks, including basic operations, data type manipulations, and the creation of data structures like lists, tuples, sets, and dictionaries. It also includes advanced tasks such as implementing a Student Management System and performing slicing operations. Submission guidelines specify the file naming format and deadline for completion.

Uploaded by

maheshsingh25feb
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views3 pages

Python Practical Assignment

The document outlines a Python practical assignment consisting of various programming tasks, including basic operations, data type manipulations, and the creation of data structures like lists, tuples, sets, and dictionaries. It also includes advanced tasks such as implementing a Student Management System and performing slicing operations. Submission guidelines specify the file naming format and deadline for completion.

Uploaded by

maheshsingh25feb
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Practical Assignment

Instructions
• Answer all questions.
• Write clean and readable Python code.
• Add comments wherever required.
• Use proper variable names.
• Submit both .py file and output screenshots.
• Written document is practical copy too.

1. Write a Python program to print your name, roll number, and course name.
2. Write a program to take two numbers as input and print:
o Sum
o Difference
o Product
o Division
3. Write a program to check whether a number is even or odd.

4. Create variables of type int, float, string, and Boolean. Print their values and data types.
5. Take a number as input and convert it into:
o Integer
o Float
o String
6. Write a program to find the largest of three numbers.
7. Write a program to check whether a year is a leap year or not.
8. Write a program to calculate grades based on marks:
o 90 and above → A
o 75–89 → B
o 50–74 → C
o Below 50 → Fail

12. Create a list of 5 integers.


o Add one element
o Remove one element
o Find the maximum and minimum value
13. Write a program to sort a list in ascending and descending order.
14. Write a program to find the sum of all elements in a list.
15. Create a tuple with at least 5 elements and print its length.
16. Convert the tuple into a list and add a new element.
17. Create a tuple and perform:
o Add element
o Remove element
18. Create a dictionary with student details (name, age, marks).
19. Add a new key-value pair to the dictionary.
20. Use the pop() method to remove a key and print the updated dictionary.
21. Write a function to check whether a number is prime.
22. Write a function to find the square and cube of a number.
23. Write a function that takes a list and returns the average of its elements.
24. Create a Student Management System with the following features:
• Add student details
• Display student details
• Search student by roll number
• Update student marks
• Delete student record

Type 2
Write a Python program to create an empty list using two different methods.
Print the type of the list in both cases.
Write a Python program to create:
• A homogeneous list
• A heterogeneous list
Display both lists.
Write a Python program to perform the following list operations:
• Append an element
• Insert an element at a specific position
• Remove an element
• Delete an element using index
Write a Python program to demonstrate list slicing.
Show slicing using:
• Positive index
• Negative index
Write a Python program to create a tuple and perform the following:
• Access elements using index
• Find the length of the tuple
• Convert the tuple into a list
Write a Python program to create a set and perform:
• Add element
• Remove element
• Union of two sets
• Intersection of two sets
Write a Python program to create a dictionary with student details.
Perform the following operations:
• Add a new key-value pair
• Update an existing value
• Delete a key
Write a Python program to iterate through a dictionary and print:
• Keys
• Values
• Key–Value pairs
Write a Python program to demonstrate the difference between remove(), pop(), and del
using a list.
Write a Python program that accepts multiple values from the user, stores them in a list,
then converts the list into:
• Tuple
• Set
and displays all three.
Type 3
1. Write a Python program to demonstrate slicing on a list using positive and negative
indexes.
Display at least three different slices.
2. Write a Python program to extract alternate elements from a list using slicing.
Also extract elements in reverse order.
3. Write a Python program to perform slicing on a string.
Print:
o First 5 characters
o Last 5 characters
o Middle characters
4. Write a Python program to slice a list and modify the sliced portion.
Show how changes affect (or do not affect) the original list.
5. Write a Python program to separate even-index and odd-index elements from a list using
slicing.
6. Write a Python program to reverse a list and a string using slicing.
Compare the outputs.
7. Write a Python program to copy a list using slicing ([:]).
Modify both lists and explain whether slicing creates a shallow or deep copy.
8. Write a Python program to slice a 2D list (list of lists) and extract specific rows and
columns.
9. Write a Python program that accepts a string from the user and uses slicing to check
whether it is a palindrome.
10. Predict the output of the following slicing operations and justify your answer:
data = [10, 20, 30, 40, 50, 60, 70]
print(data[1:6:2])
print(data[::-1])
print(data[-5:-1])

Submission Guidelines
• File name format: Python_Practical_Assignment_<YourName>.py
• Submission deadline: 9th Feb 2026.

End of Assignment

You might also like