[Type A] Python Revision Tour-1 – Chapter 1
Sumita Arora Class 12 Python Solutions is what you might have searched for. This is Unit 1 namely Python Revision tour for class 12. Follow along for computer science with python class 12 sumita arora solutions (PDF). You can print the page as PDF for future reference.
Table of Contents
1. What are tokens in Python? How many types of tokens are allowed in Python? Exemplify your answer.
Tokens in Python are the smallest individual units in a program, such as keywords, identifiers, literals, and operators. There are five types of tokens allowed in Python:
- Keywords: These are reserved words that have special meanings and purposes in Python and so play a crucial role in defining the program’s structure. Examples include words like
if
,else
,for
, anddef
andclass
specifically to build functions and define objects. - Identifiers: Defined as the names that you create for variables, functions, and classes. They help you personalize your code and make it easier to understand. Remember to follow naming conventions to ensure clarity. For instance,
variable_name
,functionName
, andClassName
are all valid identifiers. - Literals: Literal constants used in Python representing raw data like numbers, text, or True/False (boolean) values. For example,
123
,'hello'
,True
, etc. - Operators: Operators are used to perform calculations and comparisons. Symbols like
+
,-
,*
, and/
handle arithmetic operations, while==
,!=
,and
, andor
helps in making logical decisions within your code. - Punctuation: These include symbols like parentheses, brackets, commas, colons, etc., used to structure the code. For example,
()
,{}
,:
,,
, etc.