Author: web-admin

Python – Remove Set Items

1. What Does “Remove Set Items” Mean? Removing set items means deleting values from a set. Remember: 👉 A set has no order👉 You cannot remove items using index Python gives us easy methods...

Python – Loop Sets

1. What Does “Loop Sets” Mean? Looping a set means going through each item one by one. Remember: 👉 Sets are unordered👉 You will not get items in fixed order 2. Loop Through Set...

Python – Join Sets

1. What Does “Join Sets” Mean? Joining sets means combining two or more sets. Remember: 👉 Sets store only unique values👉 Duplicate values are removed automatically 2. Join Sets Using union() union() combines all...

Python frozenset

1. What is a frozenset? A frozenset is just like a set, but with one big difference 👇 👉 A frozenset cannot be changed. In simple words: set → changeable frozenset → NOT changeable...

Python – Set Methods

1. What are Set Methods? Set methods are built-in functions that help us work easily with sets. Sets are used to: Store unique values Remove duplicates Do math-like operations (union, intersection) 2. add() –...

Python – Set Exercises

Exercise 1: Create a Set Question Create a set of fruits and print it. Solution fruits = {“apple”, “banana”, “orange”} print(fruits) Exercise 2: Remove Duplicate Values Question Remove duplicates from a list using a...

Python Dictionaries

1. What is a Dictionary? A dictionary is a collection of data stored as key : value pairs. In simple words: 👉 A dictionary is like a real dictionary Word → Meaning Key →...

Python – Access Dictionary Items

1. What Does “Access Dictionary Items” Mean? Accessing dictionary items means getting values from a dictionary using keys. Remember: 👉 Dictionaries use keys, not index numbers. 2. Access Item Using Key Name The easiest...

Python – Change Dictionary Items

1. What Does “Change Dictionary Items” Mean? Changing dictionary items means updating the value of an existing key. In simple words: 👉 We change value, not the key. 2. Change Value Using Key Name...

Python – Add Dictionary Items

1. What Does “Add Dictionary Items” Mean? Adding dictionary items means putting new key–value pairs into a dictionary. In simple words: 👉 We add a new key with its value. 2. Add Item Using...