You are on page 1of 2

Assignment 3

Lists and Tuples


1. List Creation: Write a program that creates a list of five favorite fruits entered by the user.
2. List Slicing: Given a list `[1, 2, 3, 4, 5, 6, 7, 8, 9, 10]`, write a program to print the middle
five numbers.
3. Tuple Conversion: Ask the user to enter three numbers. Store these numbers in a tuple
and print the tuple.
4. List Operations: Write a program that adds an item to the end of a list, removes the first
item, and sorts the list.
5. Element Search: Create a list of numbers. Write a program that checks if a number
entered by the user exists in the list.
6. List Reversal: Write a program that reverses the elements of a list and prints it.
7. Tuple Unpacking: Create a tuple with four elements. Write a program that unpacks these
elements into four variables and prints them.
8. Maximum and Minimum: Write a program that finds the maximum and minimum
elements in a list provided by the user.
9. Concatenate Lists: Ask the user to enter two lists. Write a program to concatenate these
lists and print the result.
10. List to Tuple: Convert a list of numbers entered by the user into a tuple and print it.

Sets and Dictionaries


1. Set Creation: Write a program that creates a set of unique numbers entered by the user.
2. Set Operations: Demonstrate the basic set operations: union, intersection, difference,
and symmetric difference.
3. Dictionary Creation: Ask the user to enter three pairs of key-value pairs and store them
in a dictionary.
4. Dictionary Lookup: Write a program that asks the user to enter a key and checks if it
exists in a given dictionary.
5. Frequency Counter: Write a program that counts the frequency of each character in a
string using a dictionary.
6. Set Membership: Write a program that checks if a given element is present in a set.
7. Dictionary Values: Write a program that prints all the values in a dictionary.
8. Merge Dictionaries: Write a program that merges two dictionaries into one.
9. Dictionary Key Removal: Write a program that removes a specified key from a
dictionary.
10. Unique Elements: Write a program that finds all the unique elements of a list and stores
them in a set.

Form of the Assignment is to provide the report of the tasks in the view of the screenshots
of the code/compilation in the docx/pdf format. and submit to the moodle’s assignment’s box.

The defense is to explain the tasks and answer the questions that would probably appear
during the explanation.

You might also like