Lab Activity 5
Lab Activity 5
Problem 1: Sum of Even Numbers Write a program that takes a list of integers as input and prints the sum of
all even numbers in the list.
Write a program that takes a list of integers as input and prints the sum of all
even numbers in the list. Problem 2: Count Elements in a Tuple
Problem 2: Count Elements in a Tuple Write a program that takes a tuple of integers as input and a specific
number. The program should print how many times the number occurs in
Write a program that takes a tuple of integers as input and a specific number.
the tuple.
The program should print how many times the number occurs in the tuple.
Problem 3: Find Union and Intersection
Problem 3: Find Union and Intersection
Write a program that takes two sets as input and prints their union and
Write a program that takes two sets as input and prints their union and
intersection.”
intersection.”
Problem 3: Find Union and Intersection
Problem 3: Find Union and Intersection
Write a program that takes two sets as input and prints their union and
Write a program that takes two sets as input and prints their union and
intersection.”
intersection.”
Problem 4: Dictionary
Problem 4: Dictionary
students = {'Alice': 85, 'Bob': 90}
students = {'Alice': 85, 'Bob': 90}
1. Add a new key-value pair to a dictionary.
1. Add a new key-value pair to a dictionary.
2. Deletes a key from the dictionary.
2. Deletes a key from the dictionary.
3. Prints the updated dictionary.
3. Prints the updated dictionary.
Problem 5: Essay
Problem 5: Essay Explain the differences between lists, tuples, sets, and dictionaries in
Python
Explain the differences between lists, tuples, sets, and dictionaries in Python