SlideShare a Scribd company logo
PYTHON - VARIABLES
AND OPERATORS
12th COMPUTER SCIENCE
LESSON - 5
Padasalai.Net
Introduction
• Python is a general purpose programming
language
• It is created by Guido Van Rossum from
CWI (Centrum Wiskunde & Informatica)
which is a National Research Institute for
Mathematics and Computer Science in
Netherlands.
• The language was released in I991.
Key features of Python
• It is a general purpose programming
language which can be used for both
scientific and non-scientific programming.
• It is a platform independent programming
language.
• The programs written in Python are easily
readable and understandable.
Programming in Python
• Interactive mode
• Script mode
Interactive mode Programming
• In interactive mode Python code can be
directly typed and the interpreter
displays the result(s) immediately.
Script mode Programming
•A script is a text file containing the Python
statements.
•Python Scripts are reusable code
Creating Scripts in Python
• FILE -> NEW
• CTRL + N
Saving Python Script
• FILE -> SAVE
• CTRL + S
Executing Python Script
• RUN -> RUN MODULE
• F5
• For all error free code, the output will appear in
the IDLE window of Python
Input and Output Functions
• input()
• print()
input() function
Variable = input(“prompt string”)
• input( ) function is used to accept data as input at
run time
• The input( ) takes whatever is typed from the
keyboard and stores the entered data in the given
variable.
• prompt string is used, it is displayed on the monitor;
the user can provide expected data from the input
device
• The input ( ) accepts all data as string or characters
but not as numbers
• int( ) function is used to convert string data as
integer data explicitly
Print() function
print(“String”)
print(variable)
print(“String”,variable)
print(variable ,“String”, variable ,“String”)
• The print() function is used to display result on
the screen
• Comma ( , ) is used as a separator in print ( ) to
print more than one item.
Comments in Python
• comments begin with hash symbol (#)
• Comments may be single line or no multi-lines.
Indentation
•Python uses whitespace such as spaces and
tabs to define program blocks
•All statements within the block must be
indented with same amount spaces.
Tokens
• Python breaks each logical line into a
sequence of elementary lexical components
known as Tokens.
1. Identifiers
2. Keywords
3. Operators
4. Delimiters
5. Literals
Identifiers
• An Identifier is a name used to identify a variable,
function, class, module or object.
• An identifier must start with an alphabet (A..Z or a..z)
or underscore ( _ ).
• Identifiers may contain digits (0 .. 9)
• Python identifiers are case sensitive i.e. uppercase
and lowercase letters are distinct.
• Identifiers must not be a python keyword.
• Python does not allow punctuation character such as
%,$, @ etc., within identifiers.
Keywords
• Keywords are special words used by Python
interpreter to recognize the structure of
program.
• Identifiers must not be a python keyword.
Operators
• In computer programming languages
operators are special symbols which represent
computations, conditional matching etc.
• The value of an operator used is called
operands.
• Arithmetic operators
• Relational or Comparative operators
• Logical operators
• Assignment operators
• Conditional operator
Arithmetic operators
• An arithmetic operator is a mathematical
operator that takes two operands and performs
a calculation on them.
Relational or Comparative operators
• A Relational operator is also called as Comparative
operator which checks the relationship between two
operands.
Logical operators
• Logical operators are used to perform logical
operations on the given relational expressions.
Assignment operators
• = is a simple assignment operator to
assign values to variable.
Ternary operator
• Ternary operator is also known as conditional
operator that evaluate something based on a
condition being true or false.
• It simply allows testing a condition in a single
line
Delimiters
• Python uses the symbols and symbol
combinations as delimiters in expressions,
lists, dictionaries and strings
Literals
• Literal is a raw data given in a variable or constant
• Numeric
• String
• Boolean
Numeric Literals
– Numeric Literals consists of digits and are immutable
String Literals
– In Python a string literal is a sequence of characters
surrounded by quotes.
– Python supports single, double and triple quotes for a string.
Boolean Literals
– A Boolean literal can have any of the two values: True or False.
Escape Sequences
• The backslash "" is a special character, also
called the "escape" character.
• It is used in representing certain whitespace
characters
Python Data types
• Number
• String
• Boolean
• Tuples
• lists
• dictionaries
எந்த அளவு நீ உயர்ந்தவனாக வவண
் டும் என
் று
நினனக்கிறாவயா அந்த அளவுக்கு கடுனமயான
வ ாதனனகனள நீ கடந்து ச ல்ல வவண
் டும்
CELL : 9524756933
MAIL : mrajivgandhibcomca@gmail.com

More Related Content

PDF
computer science CLASS 11 AND 12 SYLLABUS.pdf
SomnathSaha63
 
PPTX
TN 12 computer Science - ppt CHAPTER-5.pptx
knmschool
 
PPTX
chapter_5_ppt_em_220247.pptx
RAJAMURUGANAMECAPCSE
 
PPTX
PYTHON_VARIABLES_AND_OPERATORS(2022) CSD.pptx
Jeya Gowri
 
PPTX
python notes for MASTER OF COMPUTER APPLIICATION_ppt.pptx
yuvarajkumar334
 
PPTX
Welcome to python workshop
Mukul Kirti Verma
 
PPTX
Lecture 1 .
SwatiHans10
 
PPTX
parts_of_python_programming_language.pptx
Koteswari Kasireddy
 
computer science CLASS 11 AND 12 SYLLABUS.pdf
SomnathSaha63
 
TN 12 computer Science - ppt CHAPTER-5.pptx
knmschool
 
chapter_5_ppt_em_220247.pptx
RAJAMURUGANAMECAPCSE
 
PYTHON_VARIABLES_AND_OPERATORS(2022) CSD.pptx
Jeya Gowri
 
python notes for MASTER OF COMPUTER APPLIICATION_ppt.pptx
yuvarajkumar334
 
Welcome to python workshop
Mukul Kirti Verma
 
Lecture 1 .
SwatiHans10
 
parts_of_python_programming_language.pptx
Koteswari Kasireddy
 

Similar to 17575602.ppt (20)

PDF
basics of python programming5.pdf
Pushkaran3
 
PPTX
Introduction to python programming ( part-1)
Ziyauddin Shaik
 
PPTX
Learn about Python power point presentation
omsumukh85
 
PDF
Python unit 1 part-2
Vikram Nandini
 
PDF
Class_X_PYTHON_J.pdf
SanjeedaPraween
 
PDF
Advance Python Programming until operators.pdf
tabassumkaratela1
 
PDF
Python Fundamentals Class 11
chinthala Vijaya Kumar
 
PPTX
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
PDF
1_Python Basics.pdf
MaheshGour5
 
PPTX
Unit -1 CAP.pptx
malekaanjum1
 
PDF
Introduction to Python
Mohammed Sikander
 
PPTX
20BCT23 – PYTHON PROGRAMMING.pptx
gokilabrindha
 
PPTX
Python
Aashish Jain
 
PPT
Python programming
saroja20
 
PPTX
IMP PPT- Python programming fundamentals.pptx
lemonchoos
 
PDF
Python basic programing language for automation
DanialHabibi2
 
PDF
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
shetoooelshitany74
 
PPT
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
Godwin585235
 
PDF
chapter-1-review-of-python-basics-copy.pdf
SangeethManojKumar
 
PDF
PPE-Module-1.2 PPE-Module-1.2 PPE-Module-1.2.pdf
ArjayBalberan1
 
basics of python programming5.pdf
Pushkaran3
 
Introduction to python programming ( part-1)
Ziyauddin Shaik
 
Learn about Python power point presentation
omsumukh85
 
Python unit 1 part-2
Vikram Nandini
 
Class_X_PYTHON_J.pdf
SanjeedaPraween
 
Advance Python Programming until operators.pdf
tabassumkaratela1
 
Python Fundamentals Class 11
chinthala Vijaya Kumar
 
Introduction-to-Python-Programming1.pptx
vijayalakshmi257551
 
1_Python Basics.pdf
MaheshGour5
 
Unit -1 CAP.pptx
malekaanjum1
 
Introduction to Python
Mohammed Sikander
 
20BCT23 – PYTHON PROGRAMMING.pptx
gokilabrindha
 
Python
Aashish Jain
 
Python programming
saroja20
 
IMP PPT- Python programming fundamentals.pptx
lemonchoos
 
Python basic programing language for automation
DanialHabibi2
 
Py-Slides- easuajsjsjejejjwlqpqpqpp1.pdf
shetoooelshitany74
 
notwa dfdfvs gf fdgfgh s thgfgh frg reggg
Godwin585235
 
chapter-1-review-of-python-basics-copy.pdf
SangeethManojKumar
 
PPE-Module-1.2 PPE-Module-1.2 PPE-Module-1.2.pdf
ArjayBalberan1
 
Ad

Recently uploaded (20)

PPTX
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
PDF
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
PDF
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PPTX
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
PPTX
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
PPTX
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
PDF
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
DOCX
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
PDF
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
PPTX
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
PPTX
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
PPTX
CDH. pptx
AneetaSharma15
 
PPTX
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
PPTX
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
PPTX
How to Apply for a Job From Odoo 18 Website
Celine George
 
DOCX
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
PDF
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
PPTX
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
PPTX
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
PDF
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Information Texts_Infographic on Forgetting Curve.pptx
Tata Sevilla
 
The-Invisible-Living-World-Beyond-Our-Naked-Eye chapter 2.pdf/8th science cur...
Sandeep Swamy
 
Review of Related Literature & Studies.pdf
Thelma Villaflores
 
PROTIEN ENERGY MALNUTRITION: NURSING MANAGEMENT.pptx
PRADEEP ABOTHU
 
Command Palatte in Odoo 18.1 Spreadsheet - Odoo Slides
Celine George
 
CARE OF UNCONSCIOUS PATIENTS .pptx
AneetaSharma15
 
What is CFA?? Complete Guide to the Chartered Financial Analyst Program
sp4989653
 
pgdei-UNIT -V Neurological Disorders & developmental disabilities
JELLA VISHNU DURGA PRASAD
 
Health-The-Ultimate-Treasure (1).pdf/8th class science curiosity /samyans edu...
Sandeep Swamy
 
Introduction to pediatric nursing in 5th Sem..pptx
AneetaSharma15
 
Python-Application-in-Drug-Design by R D Jawarkar.pptx
Rahul Jawarkar
 
CDH. pptx
AneetaSharma15
 
How to Close Subscription in Odoo 18 - Odoo Slides
Celine George
 
HEALTH CARE DELIVERY SYSTEM - UNIT 2 - GNM 3RD YEAR.pptx
Priyanshu Anand
 
How to Apply for a Job From Odoo 18 Website
Celine George
 
SAROCES Action-Plan FOR ARAL PROGRAM IN DEPED
Levenmartlacuna1
 
Antianginal agents, Definition, Classification, MOA.pdf
Prerana Jadhav
 
Artificial Intelligence in Gastroentrology: Advancements and Future Presprec...
AyanHossain
 
Dakar Framework Education For All- 2000(Act)
santoshmohalik1
 
Biological Classification Class 11th NCERT CBSE NEET.pdf
NehaRohtagi1
 
Ad

17575602.ppt

  • 1. PYTHON - VARIABLES AND OPERATORS 12th COMPUTER SCIENCE LESSON - 5 Padasalai.Net
  • 2. Introduction • Python is a general purpose programming language • It is created by Guido Van Rossum from CWI (Centrum Wiskunde & Informatica) which is a National Research Institute for Mathematics and Computer Science in Netherlands. • The language was released in I991.
  • 3. Key features of Python • It is a general purpose programming language which can be used for both scientific and non-scientific programming. • It is a platform independent programming language. • The programs written in Python are easily readable and understandable.
  • 4. Programming in Python • Interactive mode • Script mode
  • 5. Interactive mode Programming • In interactive mode Python code can be directly typed and the interpreter displays the result(s) immediately. Script mode Programming •A script is a text file containing the Python statements. •Python Scripts are reusable code
  • 6. Creating Scripts in Python • FILE -> NEW • CTRL + N Saving Python Script • FILE -> SAVE • CTRL + S Executing Python Script • RUN -> RUN MODULE • F5 • For all error free code, the output will appear in the IDLE window of Python
  • 7. Input and Output Functions • input() • print()
  • 8. input() function Variable = input(“prompt string”) • input( ) function is used to accept data as input at run time • The input( ) takes whatever is typed from the keyboard and stores the entered data in the given variable. • prompt string is used, it is displayed on the monitor; the user can provide expected data from the input device • The input ( ) accepts all data as string or characters but not as numbers • int( ) function is used to convert string data as integer data explicitly
  • 9. Print() function print(“String”) print(variable) print(“String”,variable) print(variable ,“String”, variable ,“String”) • The print() function is used to display result on the screen • Comma ( , ) is used as a separator in print ( ) to print more than one item.
  • 10. Comments in Python • comments begin with hash symbol (#) • Comments may be single line or no multi-lines. Indentation •Python uses whitespace such as spaces and tabs to define program blocks •All statements within the block must be indented with same amount spaces.
  • 11. Tokens • Python breaks each logical line into a sequence of elementary lexical components known as Tokens. 1. Identifiers 2. Keywords 3. Operators 4. Delimiters 5. Literals
  • 12. Identifiers • An Identifier is a name used to identify a variable, function, class, module or object. • An identifier must start with an alphabet (A..Z or a..z) or underscore ( _ ). • Identifiers may contain digits (0 .. 9) • Python identifiers are case sensitive i.e. uppercase and lowercase letters are distinct. • Identifiers must not be a python keyword. • Python does not allow punctuation character such as %,$, @ etc., within identifiers.
  • 13. Keywords • Keywords are special words used by Python interpreter to recognize the structure of program. • Identifiers must not be a python keyword.
  • 14. Operators • In computer programming languages operators are special symbols which represent computations, conditional matching etc. • The value of an operator used is called operands. • Arithmetic operators • Relational or Comparative operators • Logical operators • Assignment operators • Conditional operator
  • 15. Arithmetic operators • An arithmetic operator is a mathematical operator that takes two operands and performs a calculation on them.
  • 16. Relational or Comparative operators • A Relational operator is also called as Comparative operator which checks the relationship between two operands.
  • 17. Logical operators • Logical operators are used to perform logical operations on the given relational expressions.
  • 18. Assignment operators • = is a simple assignment operator to assign values to variable.
  • 19. Ternary operator • Ternary operator is also known as conditional operator that evaluate something based on a condition being true or false. • It simply allows testing a condition in a single line
  • 20. Delimiters • Python uses the symbols and symbol combinations as delimiters in expressions, lists, dictionaries and strings
  • 21. Literals • Literal is a raw data given in a variable or constant • Numeric • String • Boolean Numeric Literals – Numeric Literals consists of digits and are immutable String Literals – In Python a string literal is a sequence of characters surrounded by quotes. – Python supports single, double and triple quotes for a string. Boolean Literals – A Boolean literal can have any of the two values: True or False.
  • 22. Escape Sequences • The backslash "" is a special character, also called the "escape" character. • It is used in representing certain whitespace characters
  • 23. Python Data types • Number • String • Boolean • Tuples • lists • dictionaries
  • 24. எந்த அளவு நீ உயர்ந்தவனாக வவண ் டும் என ் று நினனக்கிறாவயா அந்த அளவுக்கு கடுனமயான வ ாதனனகனள நீ கடந்து ச ல்ல வவண ் டும் CELL : 9524756933 MAIL : [email protected]