SlideShare a Scribd company logo
2
Most read
4
Most read
21
Most read
INTRODUCTION TO PYTHON
FIRST PROGRAM IN PYTHON
10/10/2021
MS.DEEPALI SHINKAR 2
PYTHON IDENTIFIER
An identifier is a name given to entities like class, functions,
variables, etc. It helps to differentiate one entity from another.
Rules for writing identifiers:
I. Identifiers can be a combination of letters in lowercase (a to z) or
uppercase (A to Z) or digits (0 to 9) or an underscore _. Names
like myClass, var_1 and print_this_to_screen, _hrs all are valid
example.
II. An identifier cannot start with a digit. 1 variable is invalid,
but variable1 is perfectly fine.
III. Keywords cannot be used as identifiers.
10/10/2021
MS.DEEPALI SHINKAR 3
KEYWORDS
10/10/2021
MS.DEEPALI SHINKAR 4
 Every programming language has special reserved words,
or keywords, that have specific meanings and restrictions
around how they should be used.
Python keywords are the fundamental building blocks of any
Python program.
Python keywords are different from Python’s built-in functions
and types.
KEYWORDS
10/10/2021
MS.DEEPALI SHINKAR 5
 Every programming language has special reserved words,
or keywords, that have specific meanings and restrictions
around how they should be used.
Python keywords are the fundamental building blocks of any
Python program.
Python keywords are different from Python’s built-in functions
and types.
GETTING THE LIST OF KEYWORDS IN THE
PROMPT
10/10/2021
MS.DEEPALI SHINKAR 6
KEYWORDS
 Value Keywords: True, False, None.
 Operator Keywords: and, or, not, in, is.
 Import Keywords: import, from, as.
10/10/2021
MS.DEEPALI SHINKAR 7
OPERATOR KEYWORDS
Operator keyword : and will result into True only if both
the operands are True.
10/10/2021
MS.DEEPALI SHINKAR 8
A B A and B
True True True
True False False
False True False
False False False
OPERATOR KEYWORDS
Operator keyword : or will result into True only if any
operands are True.
10/10/2021
MS.DEEPALI SHINKAR 9
A B A and B
True True True
True False True
False True True
False False False
OPERATOR KEYWORDS
Operator keyword : not operator is used to invert the
truth value.
10/10/2021
MS.DEEPALI SHINKAR 10
A not A
True False
False True
IMPORT KEYWORD
 Import keyword :as is used to create an object while importing a
module. It means giving a different name(user-defined) to a module
while importing it.
10/10/2021
MS.DEEPALI SHINKAR 11
IMPORT KEYWORD
Import keyword : from…… import is used to import
specific attributes or functions into the current
namespace.
10/10/2021
MS.DEEPALI SHINKAR 12
LINES AND INDENTATION
10/10/2021
MS.DEEPALI SHINKAR 13
COMMENTS
Use of comments
• Comments can be used to explain Python code.
• Comments can be used to make the code more readable.
• Comments can be used to prevent execution when testing
code.
10/10/2021
MS.DEEPALI SHINKAR 14
COMMENT
In Python, we use the hash (#) symbol to start writing a comment.
It extends up to the newline character.
These triple quotes(‘’’ ‘’’) are generally used for multi-line strings.
But they can be used as multi-line comment as well.
Example : """This is also a
perfect example of
multi-line comments"""
10/10/2021
MS.DEEPALI SHINKAR 15
STATEMENT
 Instructions that a Python interpreter can execute are called
statements.
For example, a = 1 is an assignment statement.
10/10/2021
MS.DEEPALI SHINKAR 16
MULTILINE STATEMENT
 In Python, end of a statement is marked by a newline character. But we can make a
statement extend over multiple lines with the line continuation character ().
For example:
a = 1 + 2 + 3 + 
4 + 5 + 6 + 
7 + 8 + 9
 This is explicit line continuation. In Python, line continuation is implied inside
parentheses ( ), brackets [ ] and braces { }. For instance, we can implement the above
multi-line statement as
a = (1 + 2 + 3 +
4 + 5 + 6 +
7 + 8 + 9)
 Here, the surrounding parentheses ( ) do the line continuation implicitly. Same is the
case with [ ] and { }.
 We could also put multiple statements in a single line using semicolons, as follows
a = 1; b = 2; c = 3
10/10/2021
MS.DEEPALI SHINKAR 17
GETTING USER INPUT
• While Python provides us with two inbuilt functions to read the
input from the keyboard.
input ( prompt )
raw_input ( prompt )
10/10/2021
MS.DEEPALI SHINKAR 18
INPUT FUNCTION
 This function first takes the input from the user and then
evaluates the expression, which means Python automatically
identifies whether user entered a string or a number or list.
If the input provided is not correct then either syntax error or
exception is raised by python.
10/10/2021
MS.DEEPALI SHINKAR 19
WHAT ARE VARIABLES?
A variable is created the moment you first assign a
value to it.
Variables are containers for storing data values.
• Creating Python Variable :
Python has no command for declaring a variable.
10/10/2021
MS.DEEPALI SHINKAR 20
PYTHON VARIABLES - ASSIGN MULTIPLE
VALUES
Many Values to Multiple Variables:
Python allows you to assign values to multiple variables in one line.
One Value to Multiple Variables:
And you can assign the same value to multiple variables in one line.
Unpack a Collection
If you have a collection of values in a list, tuple etc. Python allows
you extract the values into variables. This is called unpacking.
10/10/2021
MS.DEEPALI SHINKAR 21

More Related Content

PPTX
Numbers and math module
PDF
Assignment5
PDF
Chaptr 1
PDF
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
PDF
Session 5-exersice
PDF
Semantic Analysis of a C Program
PDF
C programming | Class 8 | III Term
PPTX
C data type format specifier
Numbers and math module
Assignment5
Chaptr 1
Computer experiments 1^j2^j3^j4^j8^j9. d24 ^j sakshi gawade cs branch
Session 5-exersice
Semantic Analysis of a C Program
C programming | Class 8 | III Term
C data type format specifier

What's hot (19)

PDF
Handout#09
PPT
Beginner C++ easy slide and simple definition with questions
PPT
8.Integer Overflows
PPT
C++ for beginners
PPTX
C++ lecture 01
PPT
C language Unit 2 Slides, UPTU C language
PDF
Assignment2
PDF
Lesson 02 python keywords and identifiers
PDF
Fundamentals of Computing and C Programming - Part 1
PPT
Help with Pyhon Programming Homework
PPT
Getting started with c++
PPT
Data types and Operators
DOCX
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
PDF
C programming part4
PPTX
C++
 
PDF
Assignment8
PPT
Basics of c++
PDF
C language
PDF
Handout#08
Handout#09
Beginner C++ easy slide and simple definition with questions
8.Integer Overflows
C++ for beginners
C++ lecture 01
C language Unit 2 Slides, UPTU C language
Assignment2
Lesson 02 python keywords and identifiers
Fundamentals of Computing and C Programming - Part 1
Help with Pyhon Programming Homework
Getting started with c++
Data types and Operators
CLASS VIII COMPUTERS FLOW CHART AND ALGORITHM
C programming part4
C++
 
Assignment8
Basics of c++
C language
Handout#08
Ad

Similar to Basic concepts of python (20)

PDF
Python PPT1.pdf
PPTX
MODULE hdsfsf gefegsfs wfefwfwfg etegeg.pptx
PPTX
TN 12 computer Science - ppt CHAPTER-5.pptx
PPTX
Jas_python.pptx for beginners introduction
PPTX
Python Programming Basics for begginners
PPTX
PYTHON PPT.pptx python is very useful for day to day life
PDF
Python quick guide
PPTX
python-presentationpython-presentationpython-presentation.pptx
PPTX
Python Keywords and Identifiers - An Introduction
PPTX
python slides operators and types of it.pptx
PPTX
Python fundamentals
DOCX
PYTHON-Unit-I-Notes for python learnerss
PPTX
Pyhton problem solving introduction and examples
PDF
Computer Related material named Phython ok
PPTX
Lecture 1- Python.pptxjhhhfdzdfdggcfffff
PPTX
20BCT23 – PYTHON PROGRAMMING.pptx
PPTX
Fundamentals of Python Programming
PPTX
2. Getting Started with Python second lesson .pptx
PPTX
Introduction to Python Programming language
PPTX
Python Programming - Variables, Objects and Classes
Python PPT1.pdf
MODULE hdsfsf gefegsfs wfefwfwfg etegeg.pptx
TN 12 computer Science - ppt CHAPTER-5.pptx
Jas_python.pptx for beginners introduction
Python Programming Basics for begginners
PYTHON PPT.pptx python is very useful for day to day life
Python quick guide
python-presentationpython-presentationpython-presentation.pptx
Python Keywords and Identifiers - An Introduction
python slides operators and types of it.pptx
Python fundamentals
PYTHON-Unit-I-Notes for python learnerss
Pyhton problem solving introduction and examples
Computer Related material named Phython ok
Lecture 1- Python.pptxjhhhfdzdfdggcfffff
20BCT23 – PYTHON PROGRAMMING.pptx
Fundamentals of Python Programming
2. Getting Started with Python second lesson .pptx
Introduction to Python Programming language
Python Programming - Variables, Objects and Classes
Ad

More from deepalishinkar1 (20)

PPTX
data structure stack appplication in python
PPTX
Stack application in infix to prefix expression
PPTX
Data Structure Stack operation in python
PPTX
steps for template in django for project
PDF
Web application on menu card qrcode generator.pdf
PPTX
Django model create a table in django web framework
PPTX
TO DO APP USING STREAMLIT PYTHON PROJECT
PPTX
basic concepts of object oriented in python
PDF
Inheritance and polymorphism oops concepts in python
PPTX
DATABASE CONNECTIVITY PYTHON USING MYSQL/SQLITE/POSTGRE
PPTX
File Operations in python Read ,Write,binary file etc.
PDF
How to create a django project procedure
PDF
Virtual environment in python on windows / linux os
PPTX
Operators in python
PPTX
Data handling in python
PDF
Practical approach on numbers system and math module
PDF
Demonstration on keyword
PPTX
Introduction to python
PDF
Set methods in python
PDF
Data type list_methods_in_python
data structure stack appplication in python
Stack application in infix to prefix expression
Data Structure Stack operation in python
steps for template in django for project
Web application on menu card qrcode generator.pdf
Django model create a table in django web framework
TO DO APP USING STREAMLIT PYTHON PROJECT
basic concepts of object oriented in python
Inheritance and polymorphism oops concepts in python
DATABASE CONNECTIVITY PYTHON USING MYSQL/SQLITE/POSTGRE
File Operations in python Read ,Write,binary file etc.
How to create a django project procedure
Virtual environment in python on windows / linux os
Operators in python
Data handling in python
Practical approach on numbers system and math module
Demonstration on keyword
Introduction to python
Set methods in python
Data type list_methods_in_python

Recently uploaded (20)

PDF
esg-supply-chain-webinar-nov2018hkhkkh.pdf
PPTX
cse couse aefrfrqewrbqwrgbqgvq2w3vqbvq23rbgw3rnw345
PDF
Blue-Modern-Elegant-Presentation (1).pdf
PPTX
退学买新西兰毕业证(WelTec毕业证书)惠灵顿理工学院毕业证国外证书制作
DOCX
How to Become a Criminal Profiler or Behavioural Analyst.docx
PDF
Manager Resume for R, CL & Applying Online.pdf
PDF
Josh Gao Strength to Strength Book Summary
PDF
Sales and Distribution Managemnjnfijient.pdf
PPTX
Definition and Relation of Food Science( Lecture1).pptx
PPTX
Nervous_System_Drugs_PPT.pptxXXXXXXXXXXXXXXXXX
PPTX
PMP (Project Management Professional) course prepares individuals
PDF
L-0018048598visual cloud book for PCa-pdf.pdf
PDF
Biography of Mohammad Anamul Haque Nayan
PPTX
CORE 1 HOUSEKEEPING TOURISM SECTOR POWERPOINT
PPTX
chapter 3_bem.pptxKLJLKJLKJLKJKJKLJKJKJKHJH
PPTX
Condensed_Food_Science_Lecture1_Precised.pptx
PPTX
Your Guide to a Winning Interview Aug 2025.
PPTX
The Stock at arrangement the stock and product.pptx
PPTX
internship presentation of bsnl in colllege
PPTX
Cerebral_Palsy_Detailed_Presentation.pptx
esg-supply-chain-webinar-nov2018hkhkkh.pdf
cse couse aefrfrqewrbqwrgbqgvq2w3vqbvq23rbgw3rnw345
Blue-Modern-Elegant-Presentation (1).pdf
退学买新西兰毕业证(WelTec毕业证书)惠灵顿理工学院毕业证国外证书制作
How to Become a Criminal Profiler or Behavioural Analyst.docx
Manager Resume for R, CL & Applying Online.pdf
Josh Gao Strength to Strength Book Summary
Sales and Distribution Managemnjnfijient.pdf
Definition and Relation of Food Science( Lecture1).pptx
Nervous_System_Drugs_PPT.pptxXXXXXXXXXXXXXXXXX
PMP (Project Management Professional) course prepares individuals
L-0018048598visual cloud book for PCa-pdf.pdf
Biography of Mohammad Anamul Haque Nayan
CORE 1 HOUSEKEEPING TOURISM SECTOR POWERPOINT
chapter 3_bem.pptxKLJLKJLKJLKJKJKLJKJKJKHJH
Condensed_Food_Science_Lecture1_Precised.pptx
Your Guide to a Winning Interview Aug 2025.
The Stock at arrangement the stock and product.pptx
internship presentation of bsnl in colllege
Cerebral_Palsy_Detailed_Presentation.pptx

Basic concepts of python

  • 2. FIRST PROGRAM IN PYTHON 10/10/2021 MS.DEEPALI SHINKAR 2
  • 3. PYTHON IDENTIFIER An identifier is a name given to entities like class, functions, variables, etc. It helps to differentiate one entity from another. Rules for writing identifiers: I. Identifiers can be a combination of letters in lowercase (a to z) or uppercase (A to Z) or digits (0 to 9) or an underscore _. Names like myClass, var_1 and print_this_to_screen, _hrs all are valid example. II. An identifier cannot start with a digit. 1 variable is invalid, but variable1 is perfectly fine. III. Keywords cannot be used as identifiers. 10/10/2021 MS.DEEPALI SHINKAR 3
  • 4. KEYWORDS 10/10/2021 MS.DEEPALI SHINKAR 4  Every programming language has special reserved words, or keywords, that have specific meanings and restrictions around how they should be used. Python keywords are the fundamental building blocks of any Python program. Python keywords are different from Python’s built-in functions and types.
  • 5. KEYWORDS 10/10/2021 MS.DEEPALI SHINKAR 5  Every programming language has special reserved words, or keywords, that have specific meanings and restrictions around how they should be used. Python keywords are the fundamental building blocks of any Python program. Python keywords are different from Python’s built-in functions and types.
  • 6. GETTING THE LIST OF KEYWORDS IN THE PROMPT 10/10/2021 MS.DEEPALI SHINKAR 6
  • 7. KEYWORDS  Value Keywords: True, False, None.  Operator Keywords: and, or, not, in, is.  Import Keywords: import, from, as. 10/10/2021 MS.DEEPALI SHINKAR 7
  • 8. OPERATOR KEYWORDS Operator keyword : and will result into True only if both the operands are True. 10/10/2021 MS.DEEPALI SHINKAR 8 A B A and B True True True True False False False True False False False False
  • 9. OPERATOR KEYWORDS Operator keyword : or will result into True only if any operands are True. 10/10/2021 MS.DEEPALI SHINKAR 9 A B A and B True True True True False True False True True False False False
  • 10. OPERATOR KEYWORDS Operator keyword : not operator is used to invert the truth value. 10/10/2021 MS.DEEPALI SHINKAR 10 A not A True False False True
  • 11. IMPORT KEYWORD  Import keyword :as is used to create an object while importing a module. It means giving a different name(user-defined) to a module while importing it. 10/10/2021 MS.DEEPALI SHINKAR 11
  • 12. IMPORT KEYWORD Import keyword : from…… import is used to import specific attributes or functions into the current namespace. 10/10/2021 MS.DEEPALI SHINKAR 12
  • 14. COMMENTS Use of comments • Comments can be used to explain Python code. • Comments can be used to make the code more readable. • Comments can be used to prevent execution when testing code. 10/10/2021 MS.DEEPALI SHINKAR 14
  • 15. COMMENT In Python, we use the hash (#) symbol to start writing a comment. It extends up to the newline character. These triple quotes(‘’’ ‘’’) are generally used for multi-line strings. But they can be used as multi-line comment as well. Example : """This is also a perfect example of multi-line comments""" 10/10/2021 MS.DEEPALI SHINKAR 15
  • 16. STATEMENT  Instructions that a Python interpreter can execute are called statements. For example, a = 1 is an assignment statement. 10/10/2021 MS.DEEPALI SHINKAR 16
  • 17. MULTILINE STATEMENT  In Python, end of a statement is marked by a newline character. But we can make a statement extend over multiple lines with the line continuation character (). For example: a = 1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9  This is explicit line continuation. In Python, line continuation is implied inside parentheses ( ), brackets [ ] and braces { }. For instance, we can implement the above multi-line statement as a = (1 + 2 + 3 + 4 + 5 + 6 + 7 + 8 + 9)  Here, the surrounding parentheses ( ) do the line continuation implicitly. Same is the case with [ ] and { }.  We could also put multiple statements in a single line using semicolons, as follows a = 1; b = 2; c = 3 10/10/2021 MS.DEEPALI SHINKAR 17
  • 18. GETTING USER INPUT • While Python provides us with two inbuilt functions to read the input from the keyboard. input ( prompt ) raw_input ( prompt ) 10/10/2021 MS.DEEPALI SHINKAR 18
  • 19. INPUT FUNCTION  This function first takes the input from the user and then evaluates the expression, which means Python automatically identifies whether user entered a string or a number or list. If the input provided is not correct then either syntax error or exception is raised by python. 10/10/2021 MS.DEEPALI SHINKAR 19
  • 20. WHAT ARE VARIABLES? A variable is created the moment you first assign a value to it. Variables are containers for storing data values. • Creating Python Variable : Python has no command for declaring a variable. 10/10/2021 MS.DEEPALI SHINKAR 20
  • 21. PYTHON VARIABLES - ASSIGN MULTIPLE VALUES Many Values to Multiple Variables: Python allows you to assign values to multiple variables in one line. One Value to Multiple Variables: And you can assign the same value to multiple variables in one line. Unpack a Collection If you have a collection of values in a list, tuple etc. Python allows you extract the values into variables. This is called unpacking. 10/10/2021 MS.DEEPALI SHINKAR 21