SlideShare a Scribd company logo
PYTHON- Fundamentals
As per CBSE curriculum
Class 11
Chapter- 2
Python Introduction
• In order to provide an input, process it and to
receive output, we need to write a program.
• Program, is a group of instructions which
controls processing.
• In other words, base for processing is ‘the
Program’.
• In this chapter we will come to know about
various element of processing like – character
set, token, expressions, statements, input.
Python Character Set
• Character Set-is a group of letters or signs which
are specific to a language.
• Character set includes letter, sign, number,
symbol.
– Letters: A-Z, a-z
– Digits: 0-9
– Special Symbols: _, +, -, *, /, (, ), {, } . . .Etc.
– White Spaces: blank space, tab, carriage return,
newline, formfeed etc.
– Other characters: Python can process all characters of
ASCII and UNICODE.
Tokens
• Token- is the smallest unit of any programming
language. It is also known as Lexical Unit.
Types of token are-
i. Keywords
ii. Identifiers (Names)
iii. Literals
iv. Operators
v. Punctuators
Keywords
• Keywords are those words which provides a special meaning to
interpreter.
• These are reserved for specific functioning.
• These can not be used as identifiers, variable name or any other
purpose.
• Available keywords in Python are-
Identifiers
• These are building blocks of a program and are used to give names to
different parts/blocks of a program like - variable, objects, classes,
functions.
• 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. Uppercase characters are distinct from
lowercase characters (P and p are different for interpreter).
• Length of an Identifier is unlimited.
• Keywords can not be used as an identifier.
• Space and special symbols are not permitted in an identifier name
except an underscore( _ ) sign.
• Some valid identifiers are –
– Myfile, Date9_7_17, Z2T0Z9, _DS, _CHK FILE13.
• Some invald identifiers are –
– DATA-REC, 29COLOR, break, My.File.
Literals / Values
• Literals are often called Constant Values.
• Python permits following types of literals -
– String literals - “Pankaj”
– Numeric literals – 10, 13.5, 3+5i
– Boolean literals –True or False
– Special Literal None
– Literal collections
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(“ “ or ‘ ‘
or “’ ‘”).
• In python, string is of 2 types-
– Single line string
• Text = “Hello World” or Text = ‘Hello World’
– Multi line string
• Text = ‘hello or
world’
Text = ‘’’hello
word ‘’’
Numeric Literals
• Numeric values can be of three types -
– int (signed integers)
• Decimal Integer Literals – 10, 17, 210 etc.
• Octal Integer Literals - 0o17, 0o217 etc.
• Hexadecimal Integer Literals – 0x14, 0x2A4, 0xABD etc.
– float ( floating point real value)
• Fractional Form – 2.0, 17.5 -13.5, -.00015 etc.
• Exponent Form - -1.7E+8, .25E-4 etc.
– complex (complex numbers)
• 3+5i etc.
Boolean Literals
• It can contain either of only two values –True or False
 A= True
 B=False
Special Literals
• None, which means nothing (no value).
 X = None
Operators
• An Operator is a symbol that trigger some
action when applied to identifier (s)/ operand
(s)
• Therefore, an operator requires operand (s)
to compute upon.
example :
c = a + b
Here, a, b, c are operands and operators are
= and + which are performing differently.
Types of Operators
• Python supports following types of operators -
– Unary Operator
• Unary plus (+)
• Unary Minus (-)
• Bitwise complement (~)
• Logical Negation (not)
– Binary Operator
• Arithmetic operator (+, -, *, /, %, **, //)
• Relational Operator(<, >, <=, >=, ==, != )
• Logical Operator (and, or)
• Assigment Operator (=, /=, +=, -=, *=, %=, **=, //=)
• Bitwise Operator (& bitwise and, ^ bitwise xor, | bitwise or)
• Shift operator (<< shift left, >> shift right)
• Identity Operator (is, is not)
• Membership Operator (in, not in)
Punctuators
• In Python, punctuators are used to construct
the program and to make balance between
instructions and statements. Punctuators
have their own syntactic and semantic
significance.
• Python has following Punctuators -
‘, ”, #, , (, ), [, ], {, }, @. ,, :, .. `, =
A Python Program Structure
Comments
Function
Statements
Indentation
Block
Function Calling
A Python Program Structure
• As we have seen in previous slides, a
program contains following compnents-
– Expressions like a+b, a>b etc.
– Statements like a=10, c=a+b etc.
– Comments, lines starting with #.
– Function, block starting with def keyword
– Blocks and indentation like if and else blocks
*These will be explained in detailed further.

More Related Content

Similar to chapter-2-eng-python-fundamentls1_1585929263876 by EasePDF.pptx

chapter-1-review-of-python-basics-copy.pdf
chapter-1-review-of-python-basics-copy.pdfchapter-1-review-of-python-basics-copy.pdf
chapter-1-review-of-python-basics-copy.pdf
SangeethManojKumar
 
3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf
TANZINTANZINA
 
presentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptxpresentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptx
ansariparveen06
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
Ayshwarya Baburam
 
C – A Programming Language- I
C – A Programming Language- IC – A Programming Language- I
C – A Programming Language- I
Gagan Deep
 
Python revision tour i
Python revision tour iPython revision tour i
Python revision tour i
Mr. Vikram Singh Slathia
 
Python Programming 1.pptx
Python Programming 1.pptxPython Programming 1.pptx
Python Programming 1.pptx
Francis Densil Raj
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
Eric Chou
 
c
cc
INTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptxINTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptx
Nimrahafzal1
 
PYTHON PROGRAMMING (2).pptx
PYTHON PROGRAMMING (2).pptxPYTHON PROGRAMMING (2).pptx
PYTHON PROGRAMMING (2).pptx
SoundariyaSathish
 
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
sangeeta borde
 
Python Data-Types
Python Data-TypesPython Data-Types
Python Data-Types
Akhil Kaushik
 
Biswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptxBiswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptx
BiswambarBehera5
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
TamalSengupta8
 
CH6 - Fundamentals of Python.pptx
CH6 - Fundamentals of Python.pptxCH6 - Fundamentals of Python.pptx
CH6 - Fundamentals of Python.pptx
EloAOgardo
 
An overview on python commands for solving the problems
An overview on python commands for solving the problemsAn overview on python commands for solving the problems
An overview on python commands for solving the problems
Ravikiran708913
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
UpasnaSharma37
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
vikram mahendra
 
Python programming
Python programmingPython programming
Python programming
saroja20
 

Similar to chapter-2-eng-python-fundamentls1_1585929263876 by EasePDF.pptx (20)

chapter-1-review-of-python-basics-copy.pdf
chapter-1-review-of-python-basics-copy.pdfchapter-1-review-of-python-basics-copy.pdf
chapter-1-review-of-python-basics-copy.pdf
 
3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf3a. Context Free Grammar.pdf
3a. Context Free Grammar.pdf
 
presentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptxpresentation_python_7_1569170870_375360.pptx
presentation_python_7_1569170870_375360.pptx
 
Introduction to python
Introduction to pythonIntroduction to python
Introduction to python
 
C – A Programming Language- I
C – A Programming Language- IC – A Programming Language- I
C – A Programming Language- I
 
Python revision tour i
Python revision tour iPython revision tour i
Python revision tour i
 
Python Programming 1.pptx
Python Programming 1.pptxPython Programming 1.pptx
Python Programming 1.pptx
 
Chapter 2: Elementary Programming
Chapter 2: Elementary ProgrammingChapter 2: Elementary Programming
Chapter 2: Elementary Programming
 
c
cc
c
 
INTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptxINTRODUCTION TO PYTHON.pptx
INTRODUCTION TO PYTHON.pptx
 
PYTHON PROGRAMMING (2).pptx
PYTHON PROGRAMMING (2).pptxPYTHON PROGRAMMING (2).pptx
PYTHON PROGRAMMING (2).pptx
 
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
2022-23TYBSC(CS)-Python Prog._Chapter-1.pptx
 
Python Data-Types
Python Data-TypesPython Data-Types
Python Data-Types
 
Biswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptxBiswa Sir Python Fundamentals.pptx
Biswa Sir Python Fundamentals.pptx
 
Python-Basics.pptx
Python-Basics.pptxPython-Basics.pptx
Python-Basics.pptx
 
CH6 - Fundamentals of Python.pptx
CH6 - Fundamentals of Python.pptxCH6 - Fundamentals of Python.pptx
CH6 - Fundamentals of Python.pptx
 
An overview on python commands for solving the problems
An overview on python commands for solving the problemsAn overview on python commands for solving the problems
An overview on python commands for solving the problems
 
intro to python.pptx
intro to python.pptxintro to python.pptx
intro to python.pptx
 
Python Introduction
Python IntroductionPython Introduction
Python Introduction
 
Python programming
Python programmingPython programming
Python programming
 

Recently uploaded

一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
nyvan3
 
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
slg6lamcq
 
Template xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptxTemplate xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptx
TeukuEriSyahputra
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
ihavuls
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
Timothy Spann
 
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
asyed10
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
Social Samosa
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
aguty
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
ytypuem
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
ElizabethGarrettChri
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
AlessioFois2
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Aggregage
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
Timothy Spann
 
Cell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docxCell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docx
vasanthatpuram
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
v7oacc3l
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
Sachin Paul
 
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Kaxil Naik
 
writing report business partner b1+ .pdf
writing report business partner b1+ .pdfwriting report business partner b1+ .pdf
writing report business partner b1+ .pdf
VyNguyen709676
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
hqfek
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Kiwi Creative
 

Recently uploaded (20)

一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
一比一原版英国赫特福德大学毕业证(hertfordshire毕业证书)如何办理
 
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
一比一原版南十字星大学毕业证(SCU毕业证书)学历如何办理
 
Template xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptxTemplate xxxxxxxx ssssssssssss Sertifikat.pptx
Template xxxxxxxx ssssssssssss Sertifikat.pptx
 
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
原版制作(unimelb毕业证书)墨尔本大学毕业证Offer一模一样
 
DSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelinesDSSML24_tspann_CodelessGenerativeAIPipelines
DSSML24_tspann_CodelessGenerativeAIPipelines
 
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
一比一原版美国帕森斯设计学院毕业证(parsons毕业证书)如何办理
 
The Ipsos - AI - Monitor 2024 Report.pdf
The  Ipsos - AI - Monitor 2024 Report.pdfThe  Ipsos - AI - Monitor 2024 Report.pdf
The Ipsos - AI - Monitor 2024 Report.pdf
 
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
一比一原版澳洲西澳大学毕业证(uwa毕业证书)如何办理
 
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
一比一原版(曼大毕业证书)曼尼托巴大学毕业证如何办理
 
Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024Open Source Contributions to Postgres: The Basics POSETTE 2024
Open Source Contributions to Postgres: The Basics POSETTE 2024
 
A presentation that explain the Power BI Licensing
A presentation that explain the Power BI LicensingA presentation that explain the Power BI Licensing
A presentation that explain the Power BI Licensing
 
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
Beyond the Basics of A/B Tests: Highly Innovative Experimentation Tactics You...
 
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
06-12-2024-BudapestDataForum-BuildingReal-timePipelineswithFLaNK AIM
 
Cell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docxCell The Unit of Life for NEET Multiple Choice Questions.docx
Cell The Unit of Life for NEET Multiple Choice Questions.docx
 
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
在线办理(英国UCA毕业证书)创意艺术大学毕业证在读证明一模一样
 
Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......Palo Alto Cortex XDR presentation .......
Palo Alto Cortex XDR presentation .......
 
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
Orchestrating the Future: Navigating Today's Data Workflow Challenges with Ai...
 
writing report business partner b1+ .pdf
writing report business partner b1+ .pdfwriting report business partner b1+ .pdf
writing report business partner b1+ .pdf
 
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
一比一原版爱尔兰都柏林大学毕业证(本硕)ucd学位证书如何办理
 
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging DataPredictably Improve Your B2B Tech Company's Performance by Leveraging Data
Predictably Improve Your B2B Tech Company's Performance by Leveraging Data
 

chapter-2-eng-python-fundamentls1_1585929263876 by EasePDF.pptx

  • 1. PYTHON- Fundamentals As per CBSE curriculum Class 11 Chapter- 2
  • 2. Python Introduction • In order to provide an input, process it and to receive output, we need to write a program. • Program, is a group of instructions which controls processing. • In other words, base for processing is ‘the Program’. • In this chapter we will come to know about various element of processing like – character set, token, expressions, statements, input.
  • 3. Python Character Set • Character Set-is a group of letters or signs which are specific to a language. • Character set includes letter, sign, number, symbol. – Letters: A-Z, a-z – Digits: 0-9 – Special Symbols: _, +, -, *, /, (, ), {, } . . .Etc. – White Spaces: blank space, tab, carriage return, newline, formfeed etc. – Other characters: Python can process all characters of ASCII and UNICODE.
  • 4. Tokens • Token- is the smallest unit of any programming language. It is also known as Lexical Unit. Types of token are- i. Keywords ii. Identifiers (Names) iii. Literals iv. Operators v. Punctuators
  • 5. Keywords • Keywords are those words which provides a special meaning to interpreter. • These are reserved for specific functioning. • These can not be used as identifiers, variable name or any other purpose. • Available keywords in Python are-
  • 6. Identifiers • These are building blocks of a program and are used to give names to different parts/blocks of a program like - variable, objects, classes, functions. • 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. Uppercase characters are distinct from lowercase characters (P and p are different for interpreter). • Length of an Identifier is unlimited. • Keywords can not be used as an identifier. • Space and special symbols are not permitted in an identifier name except an underscore( _ ) sign. • Some valid identifiers are – – Myfile, Date9_7_17, Z2T0Z9, _DS, _CHK FILE13. • Some invald identifiers are – – DATA-REC, 29COLOR, break, My.File.
  • 7. Literals / Values • Literals are often called Constant Values. • Python permits following types of literals - – String literals - “Pankaj” – Numeric literals – 10, 13.5, 3+5i – Boolean literals –True or False – Special Literal None – Literal collections
  • 8. 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(“ “ or ‘ ‘ or “’ ‘”). • In python, string is of 2 types- – Single line string • Text = “Hello World” or Text = ‘Hello World’ – Multi line string • Text = ‘hello or world’ Text = ‘’’hello word ‘’’
  • 9. Numeric Literals • Numeric values can be of three types - – int (signed integers) • Decimal Integer Literals – 10, 17, 210 etc. • Octal Integer Literals - 0o17, 0o217 etc. • Hexadecimal Integer Literals – 0x14, 0x2A4, 0xABD etc. – float ( floating point real value) • Fractional Form – 2.0, 17.5 -13.5, -.00015 etc. • Exponent Form - -1.7E+8, .25E-4 etc. – complex (complex numbers) • 3+5i etc.
  • 10. Boolean Literals • It can contain either of only two values –True or False  A= True  B=False Special Literals • None, which means nothing (no value).  X = None
  • 11. Operators • An Operator is a symbol that trigger some action when applied to identifier (s)/ operand (s) • Therefore, an operator requires operand (s) to compute upon. example : c = a + b Here, a, b, c are operands and operators are = and + which are performing differently.
  • 12. Types of Operators • Python supports following types of operators - – Unary Operator • Unary plus (+) • Unary Minus (-) • Bitwise complement (~) • Logical Negation (not) – Binary Operator • Arithmetic operator (+, -, *, /, %, **, //) • Relational Operator(<, >, <=, >=, ==, != ) • Logical Operator (and, or) • Assigment Operator (=, /=, +=, -=, *=, %=, **=, //=) • Bitwise Operator (& bitwise and, ^ bitwise xor, | bitwise or) • Shift operator (<< shift left, >> shift right) • Identity Operator (is, is not) • Membership Operator (in, not in)
  • 13. Punctuators • In Python, punctuators are used to construct the program and to make balance between instructions and statements. Punctuators have their own syntactic and semantic significance. • Python has following Punctuators - ‘, ”, #, , (, ), [, ], {, }, @. ,, :, .. `, =
  • 14. A Python Program Structure Comments Function Statements Indentation Block Function Calling
  • 15. A Python Program Structure • As we have seen in previous slides, a program contains following compnents- – Expressions like a+b, a>b etc. – Statements like a=10, c=a+b etc. – Comments, lines starting with #. – Function, block starting with def keyword – Blocks and indentation like if and else blocks *These will be explained in detailed further.