"Tour of Class 11 in a Chapter"
Free Downloadable PDF File Available at the End
Python is a high-level, interpreted, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Its language constructs and object-oriented approach aim to help programmers write clear, logical code for small- and large-scale projects. Developed by Guido van Rossum.
Character set is a set of valid character that represents any digit, alphabet and special symbol. The character used in a Python source program belongs to Unicode Standard.
Python Supports the following character sets-
Alphabets - A to Z and a to z.
Digits - 0 - 9
Special Characters - Space () + - * / \ ^ & % $ # @ ! _ < > ? . : ; ' " {} []
White Space - Blank space, Horizontal Tab, Carriage return, Newline, formfeed
Other Characters - Python can process any of the ASCII and Unicode characters as data or as Literals.
A smallest individual unit in a program is known as token or Lexical Unit or Lexical Element.
Python has following Tokens -
Identifiers
Keywords
Literals
Operators
Punctuators
The programmer can write a Python program by using these tokens.
Identifiers are names used to identify a variable, function, or other entities in a program.
Should begin with an upper or lowercase or an Underscore followed by any character.
Can be of any length.
Should not be a Keyword or Reserved word.
Cannot use the Symbols like - !, @, #, $, %, etc. in identifiers.
_name1
name
Name
Keywords are the reserved words in Python. We cannot use a keyword as a variable name, function name or any other identifier.
Literals refers to fixed values that the program may not alter during the program execution.
Numeric Literals
String Literals
Boolean Literals
Special Literal None
Literal Collections
A Numeric Literal is a character string whose characters are selected from the digits 0-9, a sign character (+ or -) and the decimal point.
There are three types of Numeric Literals
Integer
Float
Complex
The Literal which is stored in a variable within single quotation or double quotation marks is called String Literal.
A boolean literal is used to represent one of the two boolean values - TRUE or FALSE.
In Python, we have one special literal None. None is used to define a field that is not created. It is also used to indicate the end of lists in Python
Literal Collection are simply like List, Tuples, Dictionary and Set.
An operator is used to perform specific mathematical or logical operation on values. The value that the operators work on are called operands.
Unary Operators
Binary Operators
The operator that works on single operand to form an expression are known as unary Operators.
The operators that work upon two operands are known as binary operators.
There are several types of Binary operators:
A punctuator is a token