Some basic concepts
We have to write code using some characters. The set of all the characters supported by or recognized by the language is known as the character set of that language.
Python uses ACII/UNICODE characters.
Character Set of Python:
Alphabets: all English alphabets - a to z and A to Z.
Digits: all the digits from 0 to 9
Special Characters like: @, #, $ , !, ' , " , %, ^, &, (, ), { }, [ ], \, ~, ;, :, *
White spaces: Blank space, tab, newline, carriage return
And all ASCII and UNICODE characters are supported by python
Any kind of the character mentioned above can be used to write Python code.
Tokens in Python:
What are tokens?
In the above question you can find three different words and a symbol , 'what', 'are' , 'tokens' and '?' . Here we cannot break these words further. They are the smallest units using which the sentence is framed. Like wise when we write a Python statement, we can break it into smaller units. These smallest identifiable units using which the statements are formed is called tokens.
All the statements or instructions are made of different types of tokens.
There are different types of tokens which includes:
Keywords: - These are words with special meaning, already assigned by the language. Keywords are used for special purposes. Examples for keywords in Pythons includes - input, print, int, float, eval, try, exception, True, False
Identifiers: names given by the user for variables, functions, and other objects are known as identifiers. To name an identifier, we have to follow certain rules and the are as given below:
1. Do not use a keyword as an identifier.
2. Do not use any space. If two words are used to form an identifier, then combine them using an underscore or without any character.
3. We cant use any operator.
4. Digits are allowed but not as the first character.
5. Do not use any special symbol other than underscore.