0% found this document useful (0 votes)
5 views

Class- XI (Presentation)

The document provides an overview of Python programming, covering key concepts such as character sets, tokens, identifiers, literals, and operators. It details the rules for valid identifiers, types of literals including numeric, string, and boolean, as well as the various types of operators used in Python. Additionally, it highlights the significance of keywords and the structure of Python programs.

Uploaded by

badboy15july
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views

Class- XI (Presentation)

The document provides an overview of Python programming, covering key concepts such as character sets, tokens, identifiers, literals, and operators. It details the rules for valid identifiers, types of literals including numeric, string, and boolean, as well as the various types of operators used in Python. Additionally, it highlights the significance of keywords and the structure of Python programs.

Uploaded by

badboy15july
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 29

INTRODUCTION

Learning Outcomes:
Topics:
Introduction:
Features:
Shortcomings:
Working With Python:
Execution Modes:
Execution Modes:
Structure of Python Program:
Character set
A character set defines the valid characters that can be used in source
programs or interpreted when a program is running. The source character
set is the set of characters available for the source text.

➢ Letters : A-Z, a-z


➢ Digits : 0-9
➢ Special Symbols :!#%^&*()-_=+~'":;?/|\{}[],.<>$
➢ Whitespaces :
❖ Space : ()
❖ Horizontal Tab : (\t)
❖ Form Feed : (\f)
❖ Vertical Tab : (\v)
❖ New-Line Character : (\n)

➢ Other Character : ASCII & Unicode


A Token is the smallest element of a Python Script
that is meaningful to the Interpreter or Compiler.
The reserved words of Python, which have a special fixed
meaning for the interpreter /compiler.

Note: Keywords can’t be used as Identifier.


A Python identifier is a name used to identify a variable,
function, class, module or other object.
➢ An identifier starts with a letter A to Z or a to z or an
underscore (_) followed by zero or more letters,
underscores and digits (0 to 9).
➢ Python does not allow special characters .
➢ Identifier must not be a keyword of Python.
➢ Python is a case sensitive programming language.
➢ Space is not allowed.
➢ Examples: _Name, India, Gaya123, Gaya_123 etc.
Literals in Python can be defined as number, text, or
other data that represent values to be stored in variables.
LITERALS TYPES EXAMPLE
Numeric Literals Num=5
Examples:String
_Name,
Literals India, Gaya123, Gaya_123 etc.
“India” or “123”
Floating Literals Salary = 21000.00
Boolean Literals Value = True or Value=False
Collection Literals List=[1,2,3,4,5]
Numeric Literals:
Positive or negative whole numbers with no decimal
point, decimal numbers & Complex numbers (int, float,
complex)
Examples:- 5, -6, 122, 0, -456 , 1.25, -3.89, 2+ 5j, -3.5+4j, -
3.5-6j etc.
➢ int(Integer) :- It represents whole numbers.i,e. We
can use Positive & Negative both numbers.
Range of Integer & Long Integer
Integer : -2147483648 to 2147483647
Long Integer : Unlimited Range/Based on Memory Availability
float(Floating Point Number) :- It represents real
numbers or floating point numbers. It is written with a
decimal point that separates the integer from the
fraction number.

Examples: 3.14,-48.2 etc.

Note: A value stored as a Floating Point Number in


Python can have a maximum of 53 bits of precision.
Complex Numbers:- It represents real numbers or floating
point numbers. It is written with a decimal point that
separates the integer from the fraction number.

Examples: 3.14,-48.2 etc.


FORMS
Fractional form :- (1.25, -3.45 etc.)
Exponent form (Consists of two parts: mantissa and
exponent) :- (1.7E1) where E1=1053
Note: A value stored as a Floating Point Number in Python
can have a maximum of 53 bits of precision.
Complex Numbers:- are of the form a + bj. The first
part is real part and the second part is imaginary part
Where a and b are floats and J (or j) represents √-1
String Literals: A sequence of characters surrounded by
quotes (single or double or triple quotes)
❖ Single Line Strings (enclosing text in single or double
quotes):
S='Informatics Practices' OR S="Informatics Practice”
❖ Multiline Strings (A single string spread across
multiple lines or multiple line strings):
S="Informatics \ (backslash at the end before pressing
enter) Practices" S = '''It is a multiple line string'''
Escape Sequences: Non-graphic characters (which can
not be typed directly from the keyboard during program
execution) are represented through escape sequences.
Examples:
Operators can be defined as symbols that are used to
perform operations on operands.
Types of Operators:
1. Arithmetic Operators.
2. Relational Operators.
3. Assignment Operators.
4. Logical Operators.
5. Identity Operators
6. Membership Operators

You might also like