0% found this document useful (0 votes)
5 views2 pages

Python Shopping List and Attendance Management

The document outlines a series of tasks involving a shopping list, seat management, and attendance records. It includes operations such as adding and removing items from lists, combining lists, manipulating tuples, and managing sets and dictionaries. The final tasks involve printing details about the lists and dictionaries, including counts and updates.

Uploaded by

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

Python Shopping List and Attendance Management

The document outlines a series of tasks involving a shopping list, seat management, and attendance records. It includes operations such as adding and removing items from lists, combining lists, manipulating tuples, and managing sets and dictionaries. The final tasks involve printing details about the lists and dictionaries, including counts and updates.

Uploaded by

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

1.

You have a shopping list: ["milk", "bread", "eggs", "butter",


"cheese"]. Print the first and last items you need to buy.

2. You realize you forgot "juice" in your shopping list. Add it to the end.

3. You already bought "bread". Remove it from the list.

4. Sort your shopping list alphabetically.

5. Your friend has a list: ["tomatoes", "onions", "carrots"]. Combine


both lists into one.

6. Print how many items are now on your shopping list.

7. You want to check the list from last item to first. Print the
reversed list.

8. You have a tuple representing your booked seats: (12, 14, 15, 18).
Print the first and last seat numbers.

9. Count how many times seat 14 appears in the tuple.

10. Find the position of seat 15 in the tuple.

11. Convert the seat tuple to a list, add a new seat 20, and
convert it back to a tuple.

12. Swap the first and last seat numbers in your tuple.

13. You have a set of people attending Python class: {"Alice",


"Bob", "Charlie", "David"}. Add "Eve" to the set.

14. Another set of attendees is: {"Bob", "David", "Frank"}. Find all
people who attend either of the two classes.

15. Find the people who are attending both classes.

16. "Charlie" cannot come. Remove from the set.

17. You have a list of attendees with duplicates: ["Alice", "Bob",


"Alice", "David"]. Convert it into a set to see only unique names.

18. A dictionary stores marks: {"Alice": 85, "Bob": 90, "Charlie":


78}. Print Bob’s marks.

19. "David" joins the class with marks 88. Add him to the
dictionary.

20. "Charlie" improved his marks to 82. Update the dictionary.

21. "Alice" left the class. Remove her entry from the dictionary.

22. Print all student names (keys) and all marks (values) from
the dictionary.
23. Print how many students are currently in the dictionary.

You might also like