Character Set of Python
A character set is a collection of characters
that can be used to write a program and represent data. In Python, these
characters are combined to form meaningful elements of a program, such as
keywords, identifiers, operators, and literals.
Main Categories of the Python
Character Set
|
Category |
Examples |
|
1. Letters
(Alphabets) |
A–Z, a–z |
|
2. Digits |
0–9 |
|
3. Special
Symbols |
+, -, *, /, =,
<, >, (), [], {}, :, , |
|
4. White
Spaces |
Space, Tab,
Newline, Carriage Return |
|
5. Unicode
Characters |
Marathi ,
Hindi, Chinese, Greek, emojis, currency symbols |
1. Letters (Alphabets)
Python
recognizes both uppercase and lowercase English alphabets:
- • Uppercase letters: A to Z
- • Lowercase letters: a to z
Python
is case-sensitive. This means uppercase and lowercase letters are treated as
different characters.
For example, the names “age” and “Age”
are different identifiers.
2. Digits
Python
uses the standard digits 0 to 9 for mathematical operations and numeric
literals.
Examples:
10, 25, 100, 3.14
3. Special Symbols
Special
symbols are important for writing Python statements. They are used for
mathematical operations, comparisons, assignment, brackets, punctuation, and
other programming purposes.
- •
Mathematical operators: +, -, *, /, %,
**, //
- •
Relational and assignment symbols: <,
>, <=, >=, ==, !=, =
- •
Brackets and punctuation: (), [], {}, :,
;, ,, .
- •
Other commonly used symbols: _, #, @,
quotes and backslash
4. White Spaces
Whitespace
characters control spacing, formatting, and the layout of Python code.
Indentation is especially important in Python because it is used to define
blocks of code.
- •
Blank space (Spacebar)
- •
Tab (\t)
- •
Newline (\n)
- •
Carriage return (\r)
5. Unicode Characters
Python
supports Unicode, allowing strings to contain characters from many writing
systems around the world. This includes international scripts, emojis, and
special currency or mathematical symbols.
Examples:
• Marathi:नमस्कार
• Greek: α, β, γ
• Emojis:😊, 👍
• Currency symbols: ₹, €, $
Example of Unicode in Python
>>> name =
"देवगिरी
महाविद्यालय"
>>> print(name)
The
example shows that Python can store and display non-English characters in a
string.
Character Set and Tokens
Characters are combined to form tokens, which are the smallest meaningful units of Python code. Examples of tokens include:
- Keywords
- Identifiers
- Operators
- Literals.

0 Comments