Python Unique Characters
set(s)Practice

How many distinct characters?

A set keeps each character once. len(set(s)) is the unique count.

Picture this: drop duplicates

Add each character to a set. Duplicates disappear.

stext
→
set(s)unique
→
len(...)count

In easy words

Sets remember membership, not order. 'hello' has 4 unique letters: h, e, l, o.

Where this is used

Password variety checks, alphabet coverage, and de-duplicating tokens.

Run algorithm

Each step highlights the matching Python line. Program output appears only when a line that prints actually runs.

Ready
characters
the set so far
1s = input()
2uniq = set(s)
3print(len(uniq))
Output:

Example Program

1s = input()
2print(len(set(s)))