Career Enhancement Topic 3 List - Tuple - Set - Dictionary
Career Enhancement Topic 3 List - Tuple - Set - Dictionary
print(even_numbers)
Output:
[2, 4, 6, 8, 10]
Code-
Output:
Output-
Common elements: {4, 5}
Unique elements: {1, 2, 3, 4, 5, 6, 7, 8}
print(word_count)
Output-
{'apple': 3, 'banana': 2, 'orange': 1}
5. Combining Multiple Data Structures
Code-
# Dictionary with student names and grades
students = {
"Alice": 85,
"Bob": 90,
"Charlie": 78,
"David": 92
}
# Threshold grade
threshold = 80
Output-
Students scoring above 80: ['Alice', 'Bob', 'David']
Output-
Adult students: ['Bob', 'David']