0% found this document useful (0 votes)
15 views4 pages

Experiment 3 Python

The document outlines an academic assignment for a Python programming course, focusing on utilizing lists and tuples to manage a task list. It includes a problem statement, program code for various operations on the task list, and outputs demonstrating the functionality of the program. The conclusion highlights the study of Python's tuple and list data structures.
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)
15 views4 pages

Experiment 3 Python

The document outlines an academic assignment for a Python programming course, focusing on utilizing lists and tuples to manage a task list. It includes a problem statement, program code for various operations on the task list, and outputs demonstrating the functionality of the program. The conclusion highlights the study of Python's tuple and list data structures.
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
You are on page 1/ 4

Department of Humanities and Applied Science

Academic Year: 2024-25 Name of Student:Abhishek Pal


Semester: II Student ID:24107084
Class / Branch: F.E Div I1 Date of Performance:29/01/2024
Subject: Python Programming Date of Submission:08/02/2024
Name of Instructor: Prof. Pravin SIR
Experiment No.3

Aim:To effectively utilize Python's new data structures List and tuples for solving real-world problems
efficiently.

Problem Statement: Task List Manager: Develop a Python program to manage a task list using lists and
tuples, including adding, removing, updating, and sorting tasks.

Problem Statement: 1.Develop a Python program to manage a task list using lists and tuples, including
adding, removing, updating, and sorting tasks.

Program code:
task=['Homework' , 'Laundry', 'playing','chanting']

print("task are:" ,task)

task.sort()

print(task)

task.insert(2,"meditation")

print(task)

task.pop()

print(task)

task.remove("Homework")

print(task)
task[2]="Exercise"

print(task)

task.append("Cycling")

print(task)

task2 =['singing','cycling']

print("Extend fuction will extend the list:",task)

task1=('Homework','Laundry','playing')

task2=('singing','cycling')

task1=task1+task2

print(task1)

print(task2)

li=list(task1)

li.append("Meditation")

print(li)

todo_list = ()

# Add tasks (crat new tuples and conatenate)

todo_list +=("Buy groceries",)

todo_list +=("Clean the house",)

todo_list +=("pay bills",)

#print the tuple

print("Currebnt To-Do List:")


print(todo_list)

# Remove a completed task (create a new tuple without the task)

todo_list = tuple (task for task in todo_list if task!= "Clean the house")

print("\nAfter completing a task:")

print(todo_list)

#Add a high-priority tas at the beginnig (create anew tuple)

todo_list = ("\nfirst project report",)+ todo_list

print("\nAfter adding a high-priority task:")

print(todo_list)

#sort the tuple (convert to list, sort, and convertback to tuple)

todo_list = tuple(sorted(todo_list))

print("\n After sorting the tasks :")

print(todo_list)

# Reverse the tuple (convert to list, reverse, and convert back to tuple)

todo_list = tuple(reversed(todo_list))

print("\n After reversed the tasks :")

print(todo_list)

# clear all tasks (set to an empty tuple)

todo_list =()
print("\n After clearing all tasks :")

print(todo_list)

Output:

Conclusion: Thus, we studied the use of tuple and list data structure of python.

You might also like