Code Explanation:
1. Statement
print({1, 2, 2, 3})
2. print() Function
print() is a built-in Python function.
It is used to display output on the screen.
Syntax:
print(object)
3. Set Creation
{1, 2, 2, 3}
Curly braces {} create a set.
A set is an unordered collection of unique elements.
4. Duplicate Elements
Original set:
{1, 2, 2, 3}
The value 2 appears twice.
Sets automatically remove duplicate values.
After removing duplicates:
{1, 2, 3}
5. How print() Works
The print() function receives the set:
{1, 2, 3}
and displays it on the screen.
6. Output
{1, 2, 3}

0 Comments:
Post a Comment