[go: up one dir, main page]

0% found this document useful (0 votes)
29 views17 pages

Python Fundamentals

Class 11 python fundamentals

Uploaded by

sibanandsahu69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views17 pages

Python Fundamentals

Class 11 python fundamentals

Uploaded by

sibanandsahu69
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

PREPARED BY

SUCHITA MISHRA
PGT(COMPUTER
SC.)
PYTHON CHARACTER
SET
⚫ Character Set is a set of valid characters that a language
can recognize.
⚫ A Character represents any letter, digit, sign, symbol.
⚫ Python has the following character set:
1. Letters: A-Z, a-z
2. Digits: 0-9
3. Special Symbols: Symbols available over
keyboard. Such as: *,?,{,}, ; , % etc.
4. White spaces: Blank space, tab space , carriage
return, newline etc.
5. Other Character: ASCII and Unicode Characters.
PYTHON
TOKENS
⚫ The smallest individual unit in a program is known as
a Token or Lexical Unit.
⚫ Python has the following Tokens:
1. Keywords
2. Identifiers
3. Literals
4. Operators
5. Punctuators/ Delimiters.
KEYWORD
Sthose words which provide
⚫Keywords are
a special meaning to interpreter.

⚫These are reserved for specific


functioning.

⚫These can not be used as identifiers or for


any other purpose.
AVAILABLE KEYWORDS IN
PYTHON
False class finally is return

None continue for lambda try

True def from nonlocal while

and del global not with

as elif if or yield

assert else import pass

break except in raise


IDENTIFIER
S the building blocks of
⚫These are
a program and are used to give
names to different parts/ blocks of
a program like- variable, object,
class, function etc.
RULES TO DECLARE
AN IDENTIFIERS
⚫ An identifier may be a combination of letters and numbers.
⚫ An identifier must begin with an alphabet or an
underscore( _ ).
⚫ Subsequent letters may be numbers(0-9).
⚫ Python is case sensitive. Upper case characters are
distinct from lower case characters. (Ex: P and p are
different for interpreter).
⚫ Length of an identifier is unlimited.
⚫ Space and Special symbols are not permitted in an
identifier
name except an underscore ( _ ) sign.
⚫ Keywords can not be used as identifiers.
EXAMPLES OF
IDENTIFIERS
Valid Identifiers Invalid Identifiers
Myfile Data-Rec

Date_5_19 2date

_data break

file123 -*abc

a1b2c3 123file
LITERALS/
VALUES
⚫ Literals are data items that have fixed values.
⚫ Literals are often called Constant Values.
⚫ Python permits following types of literals:
1. String Literals
2. Numeric Literals
3. Boolean Literals
4. Special Literals
STRING
LITERALS
⚫ String Literal is a sequence of characters that can be a
combination of letters, numbers and special symbols
enclosed in quotation marks [single(’ ’), double(” ”)
or triple(’’ ‘’ / ””” “””) quotes ].
⚫ In python string is of 2 types:
1. Single line string:
 Text= ‘Hello World’ Text= “Hello World”
2. or string:
Multi line
 Text= ‘’’Hello World… or Text= “””
Hello World… How are you all!!!’ ’ How
are you all !!!”””
NUMERIC
LITERALS
⚫ Numeric Literal deals with numeric values.
⚫ In python, Numeric Literals are of 2 types:
1. Integer Literals

2. Floating point Literals


INTEGER
⚫ Integer literals are whole numbers without any fractional part.
LITERALS
⚫ An integer constant must have at least one digit and must not contain
any decimal point.
⚫ It may contain either (+) or (-) sign. A number with no sign
is assumed to be positive.
⚫ Commas can’t appear in an integer constant.
⚫ Python allows 3 types of integer literals:
1. Decimal Integer Literals : An integer literal consisting of a
sequence of digits(0---9) is taken to be decimal integer
literals. Example: 1234, +97, -19 etc.
2. Octal Integer Literals: A sequence of digits(0-7) starting with
0o(digit 0 followed by letter o ) is taken to be Octal Integer
literal. Example: 0o14, 0o7.
3. Hexadecimal Integer literals: A sequence of digits(0-9,A--
F) preceded by 0X(digit 0 followed by letter X ) is taken to
be Hexadecimal Integer literal. Example: 0X9, 0XABC.
FLOATING POINT LITERALS
⚫ Floating Point literals are also called real literals which are
having fractional parts.
⚫ These may be written in one of the two forms called
Fractional form or the Exponent form.
1. Example of Fractional Form: 3.4, 89.5, -0.07, 8. ,
.7 etc..
2. Example of Exponent Form: 125.6E3, 32E4 etc..
BOOLEAN
LITERALS
⚫ A Boolean Literal in Python is used to represent one of
the two Boolean values. That is: True or False.
⚫ Example: a= True
print(a)
O/P: True
SPECIAL LITERALS
⚫ Python has one special literal, that is None.
⚫ None is used to indicate absence of value.
⚫ Example: a=10
b= None
print(a)
print(b)
O/P: 10
OPERATORS
⚫ Operators are tokens that trigger some action/ computation
when applied to variables and other objects in an expression.
⚫ Variables and objects to which the computation is applied are
called Operands.
⚫ Based up on the number of operands, operators are of two
types.
⚫ Unary Operator: The operators that act on one operand are
referred to as Unary operators. EX: Unary + (5,8,4
etc..)
Unary -

(-5,-8 etc..)
⚫ Binary Operator: Operators that act upon two operands are
referred to as Binary operators. Example: Addition(+),
PUNCTUATORS/DELIMITERS
⚫ Punctuators are symbols that are used in Programming
language to organize sentence structures.
⚫ Example: , ‘ “ \ ( ) { } [] etc..

You might also like