Class 11 Python Fundamentals CS 083

Download as pdf or txt
Download as pdf or txt
You are on page 1of 19

In today's session:

Python Fundamentals

• Python Character Set


• Tokens
• Concept of L-value and R-value
• Comments
• Statement
UNIT RDBMS:
Data
manupulation
using SQL

@aakash7.7
Python Character Set
A character can represents any letter, digit, or any other sign.
Following are some of the python character set.
Tokens
The smallest individual unit in a program is known as token or
lexical unit.
Tokens

Keywords:

• Keywords are special identifiers with predefined meanings in


the python language

• Since they are already reserved by python language they are


also called reserved keywords
Tokens

Identifiers/Variable:

• Identifiers are names given to identify different part of


the program that is variables, objects, classes, functions, lists,
dictionaries etc.

• They are fundamental building blocks of a program


Tokens

Literals/Values:

• Literals in Python can be defined as number, text, or other


data that represent values to be stored in variables.
Tokens

Delimiters:

• Used in the structure of Syntax.

• They are used to build expressions, string literals, tuples,


dictionaries or lists..
Tokens

Operators:

Operators are special symbols that perform specific operations on


one, two, or three operands, and then return a result.
Tokens

Variables:

• Definition: Named location that refers to a value and whose


value can be used and processed during program execution.

• In Python, we can use an assignment statement to create new


variables and assign specific values to them.

• The basic assignment statement has this form:


• <variable> = <expr>
L-Value and R-Value

• Lvalue refers to object to which you can assign value. It refers


to memory location. It can appear LHS or RHS of assignment

• Rvalue refers to the value we assign to any variable. It


can appear on RHS of assignment
Comments

• Comments are used to add a remark or a note in the source code.

• Comments are not executed by interpreter.

• In Python, a single line comment starts with # (hash sign).


Statement

• It is a programming instruction that python can execute, usually in


a single line.

• Python allows the use of the line continuation character (\) at the
end of the line to continue the statement onto the next line.
Statement

• It is a programming instruction that python can execute, usually in


a single line.

• Python allows the use of the line continuation character (\) at the
end of the line to continue the statement onto the next line.
Clarity and Simplicity of Expression

• Parenthesis should be used to show the precedence of


the operators and to enclose a sub-expression.

• This removes the ambiguities and misinterpretation leading to


wrong outputs.
Blocks and Indentation

• A group of statements which are part of another statement or a


function are called block or code – block or suite in Python.

• The important thing is that all the code in the code block must
have the same number of spaces.
Blocks and Indentation

• A group of statements which are part of another statement or a


function are called block or code – block or suite in Python.

• The important thing is that all the code in the code block must
have the same number of spaces.
Thank you!

You might also like