Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
17 views

PythonAssignmentson Collection

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
17 views

PythonAssignmentson Collection

Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Python Dictionary Exercise

Exercise 1: Convert two lists into a dictionary

Exercise 2: Merge two Python dictionaries into one

Exercise 3: Print the value of key ‘history’ from the below dict

Exercise 4: Initialize dictionary with default values

Exercise 5: Create a dictionary by extracting the keys from a given dictionary

Exercise 6: Delete a list of keys from a dictionary

Exercise 7: Check if a value exists in a dictionary

Exercise 8: Rename key of a dictionary

Exercise 9: Get the key of a minimum value from the following dictionary

Exercise 10: Change value of a key in a nested dictionary


Python List Exercise
Exercise 1: Reverse a list in Python

Exercise 2: Concatenate two lists index-wise

Exercise 3: Turn every item of a list into its square

Exercise 4: Concatenate two lists in the following order

Exercise 5: Iterate both lists simultaneously

Exercise 6: Remove empty strings from the list of strings

Exercise 7: Add new item to list after a specified item

Exercise 8: Extend nested list by adding the sublist

Exercise 9: Replace list’s item with new value if found

Exercise 10: Remove all occurrences of a specific item from a list.


Python Tuple Exercise
Exercise 1: Reverse the tuple

Exercise 2: Access value 20 from the tuple

Exercise 3: Create a tuple with single item 50

Exercise 4: Unpack the tuple into 4 variables

Exercise 5: Swap two tuples in Python

Exercise 6: Copy specific elements from one tuple to a new tuple

Exercise 7: Modify the tuple

Exercise 8: Sort a tuple of tuples by 2nd item

Exercise 9: Counts the number of occurrences of item 50 from a tuple

Exercise 10: Check if all items in the tuple are the same
Python Set Exercise
Exercise 1: Add a list of elements to a set

Exercise 2: Return a new set of identical items from two sets

Exercise 3: Get Only unique items from two sets

Exercise 4: Update the first set with items that don’t exist in the second set

Exercise 5: Remove items from the set at once

Exercise 6: Return a set of elements present in Set A or B, but not both

Exercise 7: Check if two sets have any elements in common. If yes, display the common
elements

Exercise 8: Update set1 by adding items from set2, except common items

Exercise 9: Remove items from set1 that are not common to both set1 and set2

You might also like