SlideShare a Scribd company logo
Introduction of Python
What is Python?
Python is general Purpose High Level Programing Language
It can be used For
1. Desktop Application
2. Web Application
3. Mobile Application
Popular apps developed in Python
About Python
• It has very simple and straight forward Syntax.
• Python is case sensitive Language.
• It is an Object Oriented Programing Language.
• Dynamically Typed .
• Executed by interpreter
• Can run in various operating systems. Indentation is used in place of Curly Braces.
• Use variable without declaration.
• It is an Interpreted Language.
Features
• Emphasis on Code readability.
• Automatic Memory Management.
• Dynamically Typed
• Large Library
• Platform Independent
Features
• Easy to use – Due to simple syntax rule
• Interpreted language – Code execution & interpretation line by line
• Cross-platform language – It can run on windows, Linux, Macintosh
etc. equally
• Expressive language – Less code to be written as it itself express the
purpose of the code.
• Completeness – Support wide rage of library
• Free & Open Source – Can be downloaded freely and source code can
be modify for improvement
Working with python
• To run a python pgm, install a python interpreter at first
• Interpreter is also called as python shell
• >>>shows python prompt is ready to take instructions
• We can type in this prompt to execute them using python
interpreter
Two ways of python interpreter
• Interactive mode
• Script mode
Interactive mode
• Simply type in >>> prompt.
• Immediately executed of individual statement
• Convini ent for testing single line code for instant execution
• We cannot save the statements for future use
• Retype and run again
• Eg:
• 1+2
• Answer we get immediately
Script mode
• In a file, we type, save then execute it
• Extension is .py
• Tell the students to write a program to show print statements
in script mode
Python keywords
• Reserved words
• Each word has a specific meaning
• we use keyword only for the purpose for which it has been
defined
• Python is Case sensitive , so exactly we have to write
• We cannot use a keyword as a variable name, function name or any
other identifier. They are used to define the syntax and structure of the
Python language.
• In Python, keywords are case sensitive.
• There are 33 keywords in Python 3.7. This number can vary slightly
over the course of time.
• All the keywords except True, False and None are in lowercase and
they must be written as they are..
List of key words
identifiers
• Used to identify a variable, function or entity in program
• 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 _ . ...
• An identifier cannot start with a digit. ...
• Keywords cannot be used as identifiers. ...
• We cannot use special symbols like !, @, #, $, % etc. ...
• An identifier can be of any length.
• Ex: marks 1, mark2, avg like that words used to identify by us for write a program
• Area=length*breadth
variables
•A variable is a label that you can assign a value to it. The
value of a variable can change throughout the program.
•A=‘m’
•Message=“keep smiling”
•Price=587.6
comments
• Remark or note in the source code
• Easier for other persons also to understand
• #sign starts till end of # considered as comment
• Simply ignores while executing the statement
Data types
Variables can store data of different types, and different types can do
different things.
Python has the following data types built-in by default, in these
categories:
2. Getting Started with Python second lesson .pptx
Numbers or numeric
Type description
example
Int integer numbers
-12,-3,0,125
Float real or floating numbers -2.04, 4.0,
14.23
Complex complex numbers 3+4i,
2-2i
Boolean (bool)
• It is a subtype of integer
• It is a unique data type
• Consists of two constants (True and False)
• Boolean True value is non-zero, non null, non empty
• Boolean False is value zero
sequence
Ordered collection of items
• String
• List
• tuple
string
•– group of characters
•->>>str1=‘hello’
•->>>str2=“452”
•We cannot perform numerical operations on
strings, even when the string contains a value as
in str2
list
Sequence of items separated by commas and the items enclosed in
square brackets[]
Ex:
>>>list1=[10,3.5,”new delhi”,’welcome’,50]
>>>print(list1)
tuple
• Sequence of items separated by commas and the items enclosed
in parenthesis()
• Ex
• Tuple1=(10,20,”apple”,3.4,’a’)
• Print(tuple1)
SET
• Unordered collection of items
• {}
• No duplicate entries
• Ex
• Set1={10,20,10,’apple’}
• Print(type(set1))
• <class’set’>
• Print(set1)
• Output{10,20,’apple’}
NONE
• Special data type with a single value
• Used to signify the absence of value in a situation
• None supports no special operations, and it is neither false nor
zero
mapping
• Unordered datatype
• One standard mapping datatype is called dictionary
• Holds data items in key value pairs
• {}
• Dictionaries permit faster access to data
• Every key is separated from its value using a colon: sign
• >>>dict1={‘fruit’:’apple’,’climate’:’cold’}
• Print(dict1)
Mutable and immutable data types
• List and dictionary are mutable datatypes
• Refer page no 98 in NCERT BOOK
• MEMORY ALLOCATION OF num1, num2, num1=num1+100
Deciding usage of python data types
• For storing names of students, easy to update when new
admission join
• Tuples use when no change ex- names of months in a year
• When need uniqueness , avoid duplicacy, we use sets
• When we need logical association between the key:value pair,
advising to use dictionaries
• Ex: mobile phone book is a good application of dictionary
operators
• To perform mathematical or logical operation on values
• Values that the operators work on are called operands
• Ex: 10+num,
• Value is 10
• Variable num operands and the + sign is an operator
Arithmetic operators
RELATIONAL OPERATORS
assignment operators
logical operators
identity operators
membership operator
•Pg no 100 to 104 in NCERT BOOK to be
work out in lab
expression
• Combination of constants, variables and operators
• Always evaluates a value
• A value or variable is also considered as an expression but a
standalone operator is not an expression
• Precedence Of expression refer pg 105 in NCERT
STATEMENT
• IN PYTHON, A STATEMENT IS A UNIT OF CODE THAT THE PYTHON
INTERPRETER CAN EXECUTE PG NO 106 IN NCERT BOOK
INPUT, OUTPUT
• It accepts all user input as string
• Input([prompt])
• Input function terminated by pressing enter key
Type conversion
• Pg no 108,109 in NCERT BOOK
• IMPLICIT , EXPLICIT CONVERSION
DEBUGGING
• SYNTAX ERRORS
• LOGICAL ERRORS
• RUNTIME ERRORS
THANK YOU

More Related Content

PPTX
PART 1 - Python Tutorial | Variables and Data Types in Python
PPTX
Python unit 2 is added. Has python related programming content
PPTX
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
PDF
Python Module-1.1.pdf
PPTX
Python Programming 1.pptx
PPTX
Python 01.pptx
PDF
Python_Programming_PPT Basics of python programming language
PDF
Class_X_PYTHON_J.pdf
PART 1 - Python Tutorial | Variables and Data Types in Python
Python unit 2 is added. Has python related programming content
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
Python Module-1.1.pdf
Python Programming 1.pptx
Python 01.pptx
Python_Programming_PPT Basics of python programming language
Class_X_PYTHON_J.pdf

Similar to 2. Getting Started with Python second lesson .pptx (20)

PPTX
Introduction to python
PDF
Python Basics Understanding Variables.pdf
PDF
Python Basics Understanding Variables.pdf
PPTX
Python Data types like mutable and immutable
PPTX
Fundamentals of Python Programming
PPTX
BASICS OF PYTHON usefull for the student who would like to learn on their own
PDF
Computer Related material named Phython ok
PDF
GE3151_PSPP_UNIT_2_Notes
PPT
17575602.ppt
KEY
Programming with Python: Week 1
PPTX
UNIT 1 .pptx
PPTX
MODULE 2.pptx Python data handling types function
PPTX
Python programming
PPT
python introduction all the students.ppt
PPTX
Python-Certification-Training-Day-1-2.pptx
PDF
Python Programming
PPTX
Python Demo.pptx
PPTX
Python-Basics.pptx
PPTX
Python Demo.pptx
PPTX
Lecture 1 .
Introduction to python
Python Basics Understanding Variables.pdf
Python Basics Understanding Variables.pdf
Python Data types like mutable and immutable
Fundamentals of Python Programming
BASICS OF PYTHON usefull for the student who would like to learn on their own
Computer Related material named Phython ok
GE3151_PSPP_UNIT_2_Notes
17575602.ppt
Programming with Python: Week 1
UNIT 1 .pptx
MODULE 2.pptx Python data handling types function
Python programming
python introduction all the students.ppt
Python-Certification-Training-Day-1-2.pptx
Python Programming
Python Demo.pptx
Python-Basics.pptx
Python Demo.pptx
Lecture 1 .
Ad

Recently uploaded (20)

PDF
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Insiders guide to clinical Medicine.pdf
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
human mycosis Human fungal infections are called human mycosis..pptx
PPTX
Institutional Correction lecture only . . .
PPTX
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
PPTX
Cell Types and Its function , kingdom of life
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Anesthesia in Laparoscopic Surgery in India
PPTX
Pharma ospi slides which help in ospi learning
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PDF
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
Saundersa Comprehensive Review for the NCLEX-RN Examination.pdf
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Insiders guide to clinical Medicine.pdf
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Pre independence Education in Inndia.pdf
human mycosis Human fungal infections are called human mycosis..pptx
Institutional Correction lecture only . . .
Introduction_to_Human_Anatomy_and_Physiology_for_B.Pharm.pptx
Cell Types and Its function , kingdom of life
Pharmacology of Heart Failure /Pharmacotherapy of CHF
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
O7-L3 Supply Chain Operations - ICLT Program
102 student loan defaulters named and shamed – Is someone you know on the list?
Anesthesia in Laparoscopic Surgery in India
Pharma ospi slides which help in ospi learning
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
2.FourierTransform-ShortQuestionswithAnswers.pdf
O5-L3 Freight Transport Ops (International) V1.pdf
ANTIBIOTICS.pptx.pdf………………… xxxxxxxxxxxxx
Abdominal Access Techniques with Prof. Dr. R K Mishra
Ad

2. Getting Started with Python second lesson .pptx

  • 1. Introduction of Python What is Python? Python is general Purpose High Level Programing Language It can be used For 1. Desktop Application 2. Web Application 3. Mobile Application
  • 3. About Python • It has very simple and straight forward Syntax. • Python is case sensitive Language. • It is an Object Oriented Programing Language. • Dynamically Typed . • Executed by interpreter • Can run in various operating systems. Indentation is used in place of Curly Braces. • Use variable without declaration. • It is an Interpreted Language.
  • 4. Features • Emphasis on Code readability. • Automatic Memory Management. • Dynamically Typed • Large Library • Platform Independent
  • 5. Features • Easy to use – Due to simple syntax rule • Interpreted language – Code execution & interpretation line by line • Cross-platform language – It can run on windows, Linux, Macintosh etc. equally • Expressive language – Less code to be written as it itself express the purpose of the code. • Completeness – Support wide rage of library • Free & Open Source – Can be downloaded freely and source code can be modify for improvement
  • 6. Working with python • To run a python pgm, install a python interpreter at first • Interpreter is also called as python shell • >>>shows python prompt is ready to take instructions • We can type in this prompt to execute them using python interpreter
  • 7. Two ways of python interpreter • Interactive mode • Script mode
  • 8. Interactive mode • Simply type in >>> prompt. • Immediately executed of individual statement • Convini ent for testing single line code for instant execution • We cannot save the statements for future use • Retype and run again • Eg: • 1+2 • Answer we get immediately
  • 9. Script mode • In a file, we type, save then execute it • Extension is .py • Tell the students to write a program to show print statements in script mode
  • 10. Python keywords • Reserved words • Each word has a specific meaning • we use keyword only for the purpose for which it has been defined • Python is Case sensitive , so exactly we have to write
  • 11. • We cannot use a keyword as a variable name, function name or any other identifier. They are used to define the syntax and structure of the Python language. • In Python, keywords are case sensitive. • There are 33 keywords in Python 3.7. This number can vary slightly over the course of time. • All the keywords except True, False and None are in lowercase and they must be written as they are..
  • 12. List of key words
  • 13. identifiers • Used to identify a variable, function or entity in program • 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 _ . ... • An identifier cannot start with a digit. ... • Keywords cannot be used as identifiers. ... • We cannot use special symbols like !, @, #, $, % etc. ... • An identifier can be of any length. • Ex: marks 1, mark2, avg like that words used to identify by us for write a program • Area=length*breadth
  • 14. variables •A variable is a label that you can assign a value to it. The value of a variable can change throughout the program. •A=‘m’ •Message=“keep smiling” •Price=587.6
  • 15. comments • Remark or note in the source code • Easier for other persons also to understand • #sign starts till end of # considered as comment • Simply ignores while executing the statement
  • 16. Data types Variables can store data of different types, and different types can do different things. Python has the following data types built-in by default, in these categories:
  • 18. Numbers or numeric Type description example Int integer numbers -12,-3,0,125 Float real or floating numbers -2.04, 4.0, 14.23 Complex complex numbers 3+4i, 2-2i
  • 19. Boolean (bool) • It is a subtype of integer • It is a unique data type • Consists of two constants (True and False) • Boolean True value is non-zero, non null, non empty • Boolean False is value zero
  • 20. sequence Ordered collection of items • String • List • tuple
  • 21. string •– group of characters •->>>str1=‘hello’ •->>>str2=“452” •We cannot perform numerical operations on strings, even when the string contains a value as in str2
  • 22. list Sequence of items separated by commas and the items enclosed in square brackets[] Ex: >>>list1=[10,3.5,”new delhi”,’welcome’,50] >>>print(list1)
  • 23. tuple • Sequence of items separated by commas and the items enclosed in parenthesis() • Ex • Tuple1=(10,20,”apple”,3.4,’a’) • Print(tuple1)
  • 24. SET • Unordered collection of items • {} • No duplicate entries • Ex • Set1={10,20,10,’apple’} • Print(type(set1)) • <class’set’> • Print(set1) • Output{10,20,’apple’}
  • 25. NONE • Special data type with a single value • Used to signify the absence of value in a situation • None supports no special operations, and it is neither false nor zero
  • 26. mapping • Unordered datatype • One standard mapping datatype is called dictionary • Holds data items in key value pairs • {} • Dictionaries permit faster access to data • Every key is separated from its value using a colon: sign • >>>dict1={‘fruit’:’apple’,’climate’:’cold’} • Print(dict1)
  • 27. Mutable and immutable data types • List and dictionary are mutable datatypes • Refer page no 98 in NCERT BOOK • MEMORY ALLOCATION OF num1, num2, num1=num1+100
  • 28. Deciding usage of python data types • For storing names of students, easy to update when new admission join • Tuples use when no change ex- names of months in a year • When need uniqueness , avoid duplicacy, we use sets • When we need logical association between the key:value pair, advising to use dictionaries • Ex: mobile phone book is a good application of dictionary
  • 29. operators • To perform mathematical or logical operation on values • Values that the operators work on are called operands • Ex: 10+num, • Value is 10 • Variable num operands and the + sign is an operator
  • 30. Arithmetic operators RELATIONAL OPERATORS assignment operators logical operators identity operators membership operator •Pg no 100 to 104 in NCERT BOOK to be work out in lab
  • 31. expression • Combination of constants, variables and operators • Always evaluates a value • A value or variable is also considered as an expression but a standalone operator is not an expression • Precedence Of expression refer pg 105 in NCERT
  • 32. STATEMENT • IN PYTHON, A STATEMENT IS A UNIT OF CODE THAT THE PYTHON INTERPRETER CAN EXECUTE PG NO 106 IN NCERT BOOK
  • 33. INPUT, OUTPUT • It accepts all user input as string • Input([prompt]) • Input function terminated by pressing enter key
  • 34. Type conversion • Pg no 108,109 in NCERT BOOK • IMPLICIT , EXPLICIT CONVERSION
  • 35. DEBUGGING • SYNTAX ERRORS • LOGICAL ERRORS • RUNTIME ERRORS