[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:

  1. 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, and def and class specifically to build functions and define objects.
  2. 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, and ClassName are all valid identifiers.
  3. Literals: Literal constants used in Python representing raw data like numbers, text, or True/False (boolean) values. For example, 123, 'hello', True, etc.
  4. Operators: Operators are used to perform calculations and comparisons. Symbols like +, -, *, and / handle arithmetic operations, while ==, !=, and, and or helps in making logical decisions within your code.
  5. Punctuation: These include symbols like parentheses, brackets, commas, colons, etc., used to structure the code. For example, (), {}, :, ,, etc.
"Spread the light within, illuminate the hearts around you. Sharing is not just an action, but a sacred journey of connecting souls."~ Anonymous

Leave a Reply

Your email address will not be published. Required fields are marked *