SlideShare a Scribd company logo
1 of 24
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

Similar to 17575602.ppt

Programming Basics.pptx
Programming Basics.pptxProgramming Basics.pptx
Programming Basics.pptxmahendranaik18
 
Python Basics by Akanksha Bali
Python Basics by Akanksha BaliPython Basics by Akanksha Bali
Python Basics by Akanksha BaliAkanksha Bali
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programmingChetan Giridhar
 
Python programming
Python programmingPython programming
Python programmingsaroja20
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdfsamiwaris2
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1Ahmet Bulut
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfMichpice
 
Advance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learningAdvance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learningsherinjoyson
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.supriyasarkar38
 
Python-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxPython-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxmuzammildev46gmailco
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptxGnanesh12
 
Python for katana
Python for katanaPython for katana
Python for katanakedar nath
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdfalaparthi
 

Similar to 17575602.ppt (20)

Python 01.pptx
Python 01.pptxPython 01.pptx
Python 01.pptx
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Programming Basics.pptx
Programming Basics.pptxProgramming Basics.pptx
Programming Basics.pptx
 
Python Basics by Akanksha Bali
Python Basics by Akanksha BaliPython Basics by Akanksha Bali
Python Basics by Akanksha Bali
 
Python Demo.pptx
Python Demo.pptxPython Demo.pptx
Python Demo.pptx
 
Tutorial on-python-programming
Tutorial on-python-programmingTutorial on-python-programming
Tutorial on-python-programming
 
Python Programming 1.pptx
Python Programming 1.pptxPython Programming 1.pptx
Python Programming 1.pptx
 
Python programming
Python programmingPython programming
Python programming
 
Python Module-1.1.pdf
Python Module-1.1.pdfPython Module-1.1.pdf
Python Module-1.1.pdf
 
Python (3).pdf
Python (3).pdfPython (3).pdf
Python (3).pdf
 
Programming with Python: Week 1
Programming with Python: Week 1Programming with Python: Week 1
Programming with Python: Week 1
 
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdfQ-Step_WS_02102019_Practical_introduction_to_Python.pdf
Q-Step_WS_02102019_Practical_introduction_to_Python.pdf
 
Advance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learningAdvance Python programming languages-Simple Easy learning
Advance Python programming languages-Simple Easy learning
 
Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.Basic concept of Python.pptx includes design tool, identifier, variables.
Basic concept of Python.pptx includes design tool, identifier, variables.
 
Python PPT.pptx
Python PPT.pptxPython PPT.pptx
Python PPT.pptx
 
Python-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptxPython-Certification-Training-Day-1-2.pptx
Python-Certification-Training-Day-1-2.pptx
 
4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx4_Introduction to Python Programming.pptx
4_Introduction to Python Programming.pptx
 
Python intro
Python introPython intro
Python intro
 
Python for katana
Python for katanaPython for katana
Python for katana
 
Python_Unit_1.pdf
Python_Unit_1.pdfPython_Unit_1.pdf
Python_Unit_1.pdf
 

Recently uploaded

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfAyushMahapatra5
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactdawncurless
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfagholdier
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...fonyou31
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Disha Kariya
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introductionMaksud Ahmed
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3JemimahLaneBuaron
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfciinovamais
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Celine George
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphThiyagu K
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdfSoniaTolstoy
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactPECB
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfJayanti Pande
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAssociation for Project Management
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfchloefrazer622
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpinRaunakKeshri1
 

Recently uploaded (20)

Class 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdfClass 11th Physics NEET formula sheet pdf
Class 11th Physics NEET formula sheet pdf
 
Accessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impactAccessible design: Minimum effort, maximum impact
Accessible design: Minimum effort, maximum impact
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Advance Mobile Application Development class 07
Advance Mobile Application Development class 07Advance Mobile Application Development class 07
Advance Mobile Application Development class 07
 
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
Ecosystem Interactions Class Discussion Presentation in Blue Green Lined Styl...
 
Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..Sports & Fitness Value Added Course FY..
Sports & Fitness Value Added Course FY..
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3Q4-W6-Restating Informational Text Grade 3
Q4-W6-Restating Informational Text Grade 3
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17Advanced Views - Calendar View in Odoo 17
Advanced Views - Calendar View in Odoo 17
 
Z Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot GraphZ Score,T Score, Percential Rank and Box Plot Graph
Z Score,T Score, Percential Rank and Box Plot Graph
 
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdfBASLIQ CURRENT LOOKBOOK  LOOKBOOK(1) (1).pdf
BASLIQ CURRENT LOOKBOOK LOOKBOOK(1) (1).pdf
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
Beyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global ImpactBeyond the EU: DORA and NIS 2 Directive's Global Impact
Beyond the EU: DORA and NIS 2 Directive's Global Impact
 
Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1Código Creativo y Arte de Software | Unidad 1
Código Creativo y Arte de Software | Unidad 1
 
Web & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdfWeb & Social Media Analytics Previous Year Question Paper.pdf
Web & Social Media Analytics Previous Year Question Paper.pdf
 
APM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across SectorsAPM Welcome, APM North West Network Conference, Synergies Across Sectors
APM Welcome, APM North West Network Conference, Synergies Across Sectors
 
Arihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdfArihant handbook biology for class 11 .pdf
Arihant handbook biology for class 11 .pdf
 
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"Mattingly "AI & Prompt Design: The Basics of Prompt Design"
Mattingly "AI & Prompt Design: The Basics of Prompt Design"
 
Student login on Anyboli platform.helpin
Student login on Anyboli platform.helpinStudent login on Anyboli platform.helpin
Student login on Anyboli platform.helpin
 

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 : mrajivgandhibcomca@gmail.com