SlideShare uma empresa Scribd logo
1 de 57
Introduction to Python
 Python is a simple programming language used to
write codes for the computer programs.
 Python was created by Guido Van Rossum when he
was working at CWI( Centrum Wiskunde &
Informatica), which is a National research institute
for mathematics and computer science in
Netherland.
 The language was release in 1991.
 Python is a high level programing language.
verma.sameeksha90@gmail.com
2
FEATURES OF PYTHON
 It is an easy to learn general purpose programing
language.
 It is a platform independent programing language,
which means it can be used on any machine and in
any operating system.
 It has a simple syntax
 Python is a case sensitive language.
 It is an interrupted language.
 It is free to use and even free for commercial product.
verma.sameeksha90@gmail.com 3
APPLICATIONS OF PYTHON
PROGRAMING
 Build a website
 Develop games
 Program robot
 Perform scientific computation
 Develop artificial intelligence application
verma.sameeksha90@gmail.com 4
WHY LEARN PYTHON
 It cuts development time with its simple to
read syntax and easy compilation features.
 Debugging your program is a breeze in python
with its built in debugger
 Python makes programmers more productive
 Python runs on windows Linux/Unix, Mac OS
and has been ported to JAVA and .NET virtual
machines.
verma.sameeksha90@gmail.com 5
Python has evolved as the most
preferred language for Data
Analytics and the increasing search
trends on Python also indicates that
Python is the next ‘Big Thing’ and
most for professionals in the Data
Analytics Domain.
verma.sameeksha90@gmail.com 6
verma.sameeksha90@gmail.com 7
verma.sameeksha90@gmail.com 8
Arithmetic Operators
Add two operands
>>2+3
5
Subtract two operands
>>5-1
4
Multiply two operands
>>2*3
6
Divide left operand with
right and result in float.
>>6/3
2.0
verma.sameeksha90@gmail.com 9
+
-
*
/
EXAMPLE
num1 = 30
num2 = 10
Print(“num1 + num2 =“, num1+num2)
Print(“num1 - num2 =“, num1-num2)
Print(“num1 * num2 =“, num1*num2)
Print(“num1 / num2 =“, num1/num2)
OUTPUT
num1+num2= 40
num1+num2= 20
num1+num2= 300
num1+num2= 3
verma.sameeksha90@gmail.com 10
verma.sameeksha90@gmail.com 11
Assignment Operators
>>x=5
/=
 x=x/ <right operand>
 >>x/=5
 >>print(x)
 1.0
%=
 x=x% <right operand>
 >>x%=5
 >>print(x)
 0
//=
 x=x// <right operand>
 >>x//=2
 >>print(x)
 2
**=
 x=x** <right operand>
 >>x**=5
 >>print(x)
 3125
verma.sameeksha90@gmail.com 12
Comparison Operators
>
 True if left operand is
greater than the right
 >>2 > 3
 False
<
 True if left operand is less
than the right
 >>2 < 3
 True
==
 True if left operand is
equal to right
 >>2 == 3
 False
!=
 True if left operand is not
equal to the right
 >> x!= 3
 True
verma.sameeksha90@gmail.com 13
verma.sameeksha90@gmail.com 14
Logical Operators
 And
 Returns x if x is False , y otherwise
 >> 2 and 3
 3
 or
 Returns y if x is False , x otherwise
 >> 2 or 3
 2
 not
 Returns True if x is True , False otherwise
 >> not 1
 False
verma.sameeksha90@gmail.com 15
Bitwise Operators
 a| b
 Perform OR operation on
each bit of the number
 111 7
 101 5
 111 7
 a & b
 Perform AND operation on
each bit of the number
 111 7
 101 5
 101 5
 a ^ b
 Perform XOR operation on
each bit of the number
 111 7
 101 5
 010 2
 a>>b
 shift a right by b bits
 3>>2 = 0
 0011 0000
 a<<b
 shift a left by b bits
 3<<2 = 12
 0011 1100
verma.sameeksha90@gmail.com 16
verma.sameeksha90@gmail.com 17
Identity Operators
 is
 True if the operands are identical (refer to the same
object)
 >> x = 5
 >> x is 5
 True
 is not
 True if the operands are not identical (do not refer to the
same object)
 >> x = 5
 >> x is not 5
 False
verma.sameeksha90@gmail.com 18
Membership Operators
 x = [ 1,2,3,4,5]
 In
 True if it finds elements in the specified sequence
 >> 3 in x
 True
 Not in
 True if it does not finds elements in the specified
sequence
 >> 3 not in x
 False
verma.sameeksha90@gmail.com 19
verma.sameeksha90@gmail.com 20
DATATYPE
 Python is a loosely typed language. Therefore, no need
to define the datatype of variables.
 No need to declare variables before using them.
verma.sameeksha90@gmail.com 21
Datatype
Immutable
NUMBERS
 Integer
 Float
 Complex
 Strings
 Tuples
Mutable
Lists
Dictionaries
Sets
 Integer
Example 1,4 etc
4+2=6
2**3=8
 Float
Example 1.4, 2.3 etc
4.0+2.5=6.5
6/2=3.0
 Complex
Example 1+4j etc
(3+4j)+(1+1j)=4+5j
(2+2j)*2=4+4j
verma.sameeksha90@gmail.com 22
Datatype
Immutable
 Numbers
 STRINGS
 Tuples
Mutable
Lists
Dictionaries
Sets
 Strings are sequence of one-
character strings
 Example:
1. Sample = “Welcome to python
Tutorial”
2. Sample = ‘Welcome to python
Tutorial’
 Multi-line strings can be denoted
using triple quotes, “’ or “””
 Example:
1. Sample = “”” It will help you lean
Python fundamentals with
examples in detail.”””
verma.sameeksha90@gmail.com 23
Sequence operations:
 Concatenation:
 ‘Python’ + ‘Tutorial’ ‘Python Tutorial’
 Repetition:
 ‘Stem’ * 2 ‘StemStem’
 Slicing:
 string1 = ‘Stem’ string1[2:4] ‘em’
 Indexing:
 string1 = ‘Stem’ string1[-1] +string[1] ‘ms’
verma.sameeksha90@gmail.com 24
verma.sameeksha90@gmail.com 25
 Find
 str = ‘Python’ str.find(‘on’) 4
 Replaced()
 str = ‘samee’ str.replace(‘ee’,’i’) ‘sami’
 Split()
 str = ‘S,A,M’ s.split(‘,’) [‘S’,’A’,’M’,]
 Count()
 str = ‘Python’ str.count(‘P’, beg=0,end=5) 1
verma.sameeksha90@gmail.com 26
 Upper():
 str = ‘Python’ str.upper() PYTHON
 max()
 str = ‘samee’ max(str) ‘s’
 min()
 str = ‘Python’ min(str) ‘P’
 isalpha()
 str = ‘Python’ str.isalpha() True
verma.sameeksha90@gmail.com 27
DATATYPE
Immutable
 Numbers
 Strings
 TUPLES
Mutable
Lists
Dictionaries
Sets
 A tupples is a sequence of
immutable Python objects like
floating number, string literals etc
 The tuples can’t be changed unlike
lists.
 Tuples are defined using curve
braces.
verma.sameeksha90@gmail.com 28
Sequence operation:
 Concatenation:
 tup = (‘a’ , ’b’ , ’c’) tup+(‘d’ , ‘f’) (‘a’ , ’b’ , ’c’ , d’ , ‘f’)
 Repetition:
 tup = (‘a’ , ’b’ , ’c’) tup*2 (‘a’ , ’b’ , ’c’, ‘a’ , ’b’ , ’c’)
 Slicing:
 tup = (‘a’ , ’b’ , ’c’) tup[1:2] (’b’ , ’c’)
 Indexing:
 tup = (‘a’ , ’b’ , ’c’) tup[0] ‘a’
verma.sameeksha90@gmail.com 29
verma.sameeksha90@gmail.com 30
DATATYPE
Immutable
 Numbers
 Strings
 Tuples
Mutable
 LISTS
 Dictionaries
 Sets
 A lists is a sequence of mutable
Python objects like floating
number, string literals, etc.
 The lists can be modified.
 Tuples are defined using square
braces.
verma.sameeksha90@gmail.com 31
Type Specific Method:
 Append(value)
 list = [1, ‘a’, 2.5] list.append(‘d’) [1 , ‘a’ , 2.5, ’d’]
 Extend(list)
 list = [1, ‘a’ ,2.5] list.extend ([‘c’ , ’d’]) [1, ’a’, 2.5, ’c’, ’d’]
 Insert(index , value)
 list = [1, ‘a’ ,2.5] list.insert(2,’b’) [1 , ‘a’ , ’b’, 2.5]
 Pop()
 list = [1, ‘a’ ,2.5] list.pop() [‘a’ , ’b’]
verma.sameeksha90@gmail.com 32
verma.sameeksha90@gmail.com 33
DATATYPE
 Immutable
 Numbers
 Strings
 Tuples
 Mutable
 Lists
 DICTIONARIES
 Sets
 Dictionaries are perhaps the
most flexible built-in data
type in python.
 Dictionaries, items are stored
and fetched by key, instead of
by positional offset.
verma.sameeksha90@gmail.com 34
Dictionary Examples
 Empty dictionary
 myDict={}
 Dictionary with integer keys
 myDict = {1:’apple’,2:’ball’}
 Dictionary with mixed keys
 myDict = {‘name’:’John’, 1:[2,4,3]}
 From sequence having each item as a pair
 myDict = dict([(1,’apple’),(2,’ball’)])
verma.sameeksha90@gmail.com 35
Dictionary Methods
 accessing dictionary
 myDict = {1:’apple’,2:’ball’} myDict[1] ‘apple’
 len()
 myDict={1:’apple’,2:’ball’} len{myDict} 2
 key()
 myDict={1:’apple’’,2:’ball’} myDict.key() [1,2]
 values()
 myDict={1:’apple’’,2:’ball’} myDict.values() [‘apple,’ball]
 items()
 myDict={1:’apple’’,2:’ball’} myDict.items() [(1,’apple’),(2,ball)]
 Get()
 myDict={1:’apple’’,2:’ball’} myDict.get(1) ‘apple’
 Update()
 myDict={1:’a’,2:’b’} myDict.update({3:’c’}) {1:’a’,2:’b’,3:’c’}
 Pop()
 myDict={1:’apple’’,2:’ball’} myDict.pop(2) {1:’apple’}
verma.sameeksha90@gmail.com 36
verma.sameeksha90@gmail.com 37
DATATYPE
Immutable
Numbers
Strings
Tuples
Mutable
Lists
Dictionaries
SETS
 A set is an unordered
collection of items.
 Every element is unique (no
duplicates) and must be
immutable (which cannot
be changed).
verma.sameeksha90@gmail.com 38
Sets method
 creating set
 mySet = {1,2,3,3} {1,2,3}
 union
myS1={1,2,’c’}
myS2={1,’b’,’c’} myS1| myS2 {1,2,’c’,’b’}
 intersection
myS1={1,2,’c’}
myS2={1,’b’,’c’} myS1 & myS2 {1,’c’}
 difference
myS1 = {1,2,’c’}
myS2={1,’b’,’c’} myS1-myS2 {2}
verma.sameeksha90@gmail.com 39
verma.sameeksha90@gmail.com 40
verma.sameeksha90@gmail.com 41
verma.sameeksha90@gmail.com 42
1. If statement
Syntax:
if(condition):
statement 1……
else:
statement2….
verma.sameeksha90@gmail.com 43
START
CHECK
CONDITION
EXECUTE
BLOCK1
EXECUTE
BLOCK2
verma.sameeksha90@gmail.com 44
START
CHECK
CONDITION1
EXECUTE
BLOCK1
EXECUTE
BLOCK2
CHECK
CONDITION2
EXECUTE
BLOCK3
Syntax:
if(condition1):
statement 1……
elif(condition2):
statement2….
else:
statement3….
2. if…elif…else statement
verma.sameeksha90@gmail.com 45
3. while statement
Syntax:
while(condition is true):
statement 1……
verma.sameeksha90@gmail.com 46
START
CHECK
CONDITION1
EXECUTE
BLOCK1
EXIT LOOP
REPEAT
verma.sameeksha90@gmail.com 47
4. For statement
Syntax:
for iterator name in iterating sequence:
Execute statements...
verma.sameeksha90@gmail.com 48
COUNT = 0
START
Execute Statements
Add 1 to Count
repeat
Check if
Count < 10 EXIT LOOP
verma.sameeksha90@gmail.com 49
5. Break statement
Syntax:
Break
verma.sameeksha90@gmail.com
START
Check loop
Condition
Execute
Block
Check break
Condition
EXIT LOOP
EXIT LOOP
Repeat
50
verma.sameeksha90@gmail.com 51
6. Continue
Syntax:
continue
verma.sameeksha90@gmail.com 52
START
Check loop
Condition
Skip Next
Statement
Check continue
Condition
EXIT LOOP
Execute Block
Repeat
verma.sameeksha90@gmail.com 53
verma.sameeksha90@gmail.com 54
A function is a block of organized, reusable sets of instructions
that is used to perform some related actions.
 Why do we use functions?
 Re-usability of code minimizes redundancy
 Procedural decomposition makes things organized
verma.sameeksha90@gmail.com 55
USER DEFINED FUNCTION
 SYNTAX:
def func_name(arg1,arg2,arg3,…):
Statements…
return [expression]
 Example:
def add(a,b)
Sum = a+b
return sum
verma.sameeksha90@gmail.com 56
 Abs()
 The abs function returns the absolute value of the specified number.
 Syntax abs(x)
 Example x=abs(3+5j)
 All()
verma.sameeksha90@gmail.com 57

Mais conteúdo relacionado

Mais procurados

FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCEFUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCEVenugopalavarma Raja
 
Python Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and LoopsPython Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and LoopsP3 InfoTech Solutions Pvt. Ltd.
 
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsDhivyaSubramaniyam
 
Python for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.comPython for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.comShwetaAggarwal56
 
Python Modules, Packages and Libraries
Python Modules, Packages and LibrariesPython Modules, Packages and Libraries
Python Modules, Packages and LibrariesVenugopalavarma Raja
 
Python-02| Input, Output & Import
Python-02| Input, Output & ImportPython-02| Input, Output & Import
Python-02| Input, Output & ImportMohd Sajjad
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)Thai Pangsakulyanont
 
FUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCE
FUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCEFUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCE
FUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCEVenugopalavarma Raja
 
Python Puzzlers - 2016 Edition
Python Puzzlers - 2016 EditionPython Puzzlers - 2016 Edition
Python Puzzlers - 2016 EditionNandan Sawant
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python ProgrammingVijaySharma802
 
13. Java text processing
13.  Java text processing13.  Java text processing
13. Java text processingIntro C# Book
 
Chapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQChapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQIntro C# Book
 
Introduction to Python Language and Data Types
Introduction to Python Language and Data TypesIntroduction to Python Language and Data Types
Introduction to Python Language and Data TypesRavi Shankar
 

Mais procurados (20)

Python unit 3 and Unit 4
Python unit 3 and Unit 4Python unit 3 and Unit 4
Python unit 3 and Unit 4
 
Python basics
Python basicsPython basics
Python basics
 
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCEFUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
FUNCTIONS IN PYTHON. CBSE +2 COMPUTER SCIENCE
 
Python programming
Python  programmingPython  programming
Python programming
 
Python Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and LoopsPython Programming Essentials - M16 - Control Flow Statements and Loops
Python Programming Essentials - M16 - Control Flow Statements and Loops
 
python codes
python codespython codes
python codes
 
Python Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and FunctionsPython Unit 3 - Control Flow and Functions
Python Unit 3 - Control Flow and Functions
 
Python for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.comPython for data science by www.dmdiploma.com
Python for data science by www.dmdiploma.com
 
Python numbers
Python numbersPython numbers
Python numbers
 
Python basics
Python basicsPython basics
Python basics
 
Python Modules, Packages and Libraries
Python Modules, Packages and LibrariesPython Modules, Packages and Libraries
Python Modules, Packages and Libraries
 
Python-02| Input, Output & Import
Python-02| Input, Output & ImportPython-02| Input, Output & Import
Python-02| Input, Output & Import
 
Introduction to Recursion (Python)
Introduction to Recursion (Python)Introduction to Recursion (Python)
Introduction to Recursion (Python)
 
FUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCE
FUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCEFUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCE
FUNCTIONS IN PYTHON, CLASS 12 COMPUTER SCIENCE
 
Programming Homework Help
Programming Homework Help Programming Homework Help
Programming Homework Help
 
Python Puzzlers - 2016 Edition
Python Puzzlers - 2016 EditionPython Puzzlers - 2016 Edition
Python Puzzlers - 2016 Edition
 
Introduction to Python Programming
Introduction to Python ProgrammingIntroduction to Python Programming
Introduction to Python Programming
 
13. Java text processing
13.  Java text processing13.  Java text processing
13. Java text processing
 
Chapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQChapter 22. Lambda Expressions and LINQ
Chapter 22. Lambda Expressions and LINQ
 
Introduction to Python Language and Data Types
Introduction to Python Language and Data TypesIntroduction to Python Language and Data Types
Introduction to Python Language and Data Types
 

Semelhante a Python

Raspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry PiRaspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry PiMohamed Abdallah
 
Introduction to python programming 1
Introduction to python programming   1Introduction to python programming   1
Introduction to python programming 1Giovanni Della Lunga
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxjovannyflex
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxjovannyflex
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfsagar414433
 
Data Handling.pdf
Data Handling.pdfData Handling.pdf
Data Handling.pdfMILANOP1
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsYashJain47002
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptxmohitesoham12
 
Basics of Python programming (part 2)
Basics of Python programming (part 2)Basics of Python programming (part 2)
Basics of Python programming (part 2)Pedro Rodrigues
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7decoupled
 
The Ring programming language version 1.7 book - Part 26 of 196
The Ring programming language version 1.7 book - Part 26 of 196The Ring programming language version 1.7 book - Part 26 of 196
The Ring programming language version 1.7 book - Part 26 of 196Mahmoud Samir Fayed
 

Semelhante a Python (20)

Raspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry PiRaspberry Pi - Lecture 5 Python for Raspberry Pi
Raspberry Pi - Lecture 5 Python for Raspberry Pi
 
Introduction to python programming 1
Introduction to python programming   1Introduction to python programming   1
Introduction to python programming 1
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
 
Lecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptxLecture 5 – Computing with Numbers (Math Lib).pptx
Lecture 5 – Computing with Numbers (Math Lib).pptx
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 
Python_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdfPython_Cheat_Sheet_Keywords_1664634397.pdf
Python_Cheat_Sheet_Keywords_1664634397.pdf
 
Python slide
Python slidePython slide
Python slide
 
Python
PythonPython
Python
 
Data Handling.pdf
Data Handling.pdfData Handling.pdf
Data Handling.pdf
 
Python basics
Python basicsPython basics
Python basics
 
Lec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questionsLec2_cont.pptx galgotias University questions
Lec2_cont.pptx galgotias University questions
 
Introduction to Python
Introduction to Python  Introduction to Python
Introduction to Python
 
Python.pdf
Python.pdfPython.pdf
Python.pdf
 
Python Programming for basic beginners.pptx
Python Programming for basic beginners.pptxPython Programming for basic beginners.pptx
Python Programming for basic beginners.pptx
 
Basics of Python programming (part 2)
Basics of Python programming (part 2)Basics of Python programming (part 2)
Basics of Python programming (part 2)
 
Programming with Python
Programming with PythonProgramming with Python
Programming with Python
 
Python Session - 3
Python Session - 3Python Session - 3
Python Session - 3
 
An overview of Python 2.7
An overview of Python 2.7An overview of Python 2.7
An overview of Python 2.7
 
A tour of Python
A tour of PythonA tour of Python
A tour of Python
 
The Ring programming language version 1.7 book - Part 26 of 196
The Ring programming language version 1.7 book - Part 26 of 196The Ring programming language version 1.7 book - Part 26 of 196
The Ring programming language version 1.7 book - Part 26 of 196
 

Último

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingrknatarajan
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxupamatechverse
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...RajaP95
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )Tsuyoshi Horigome
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduitsrknatarajan
 

Último (20)

UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and workingUNIT-V FMM.HYDRAULIC TURBINE - Construction and working
UNIT-V FMM.HYDRAULIC TURBINE - Construction and working
 
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptxIntroduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
IMPLICATIONS OF THE ABOVE HOLISTIC UNDERSTANDING OF HARMONY ON PROFESSIONAL E...
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service NashikCall Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
Call Girls Service Nashik Vaishnavi 7001305949 Independent Escort Service Nashik
 
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 

Python

  • 1.
  • 2. Introduction to Python  Python is a simple programming language used to write codes for the computer programs.  Python was created by Guido Van Rossum when he was working at CWI( Centrum Wiskunde & Informatica), which is a National research institute for mathematics and computer science in Netherland.  The language was release in 1991.  Python is a high level programing language. verma.sameeksha90@gmail.com 2
  • 3. FEATURES OF PYTHON  It is an easy to learn general purpose programing language.  It is a platform independent programing language, which means it can be used on any machine and in any operating system.  It has a simple syntax  Python is a case sensitive language.  It is an interrupted language.  It is free to use and even free for commercial product. verma.sameeksha90@gmail.com 3
  • 4. APPLICATIONS OF PYTHON PROGRAMING  Build a website  Develop games  Program robot  Perform scientific computation  Develop artificial intelligence application verma.sameeksha90@gmail.com 4
  • 5. WHY LEARN PYTHON  It cuts development time with its simple to read syntax and easy compilation features.  Debugging your program is a breeze in python with its built in debugger  Python makes programmers more productive  Python runs on windows Linux/Unix, Mac OS and has been ported to JAVA and .NET virtual machines. verma.sameeksha90@gmail.com 5
  • 6. Python has evolved as the most preferred language for Data Analytics and the increasing search trends on Python also indicates that Python is the next ‘Big Thing’ and most for professionals in the Data Analytics Domain. verma.sameeksha90@gmail.com 6
  • 9. Arithmetic Operators Add two operands >>2+3 5 Subtract two operands >>5-1 4 Multiply two operands >>2*3 6 Divide left operand with right and result in float. >>6/3 2.0 verma.sameeksha90@gmail.com 9 + - * /
  • 10. EXAMPLE num1 = 30 num2 = 10 Print(“num1 + num2 =“, num1+num2) Print(“num1 - num2 =“, num1-num2) Print(“num1 * num2 =“, num1*num2) Print(“num1 / num2 =“, num1/num2) OUTPUT num1+num2= 40 num1+num2= 20 num1+num2= 300 num1+num2= 3 verma.sameeksha90@gmail.com 10
  • 12. Assignment Operators >>x=5 /=  x=x/ <right operand>  >>x/=5  >>print(x)  1.0 %=  x=x% <right operand>  >>x%=5  >>print(x)  0 //=  x=x// <right operand>  >>x//=2  >>print(x)  2 **=  x=x** <right operand>  >>x**=5  >>print(x)  3125 verma.sameeksha90@gmail.com 12
  • 13. Comparison Operators >  True if left operand is greater than the right  >>2 > 3  False <  True if left operand is less than the right  >>2 < 3  True ==  True if left operand is equal to right  >>2 == 3  False !=  True if left operand is not equal to the right  >> x!= 3  True verma.sameeksha90@gmail.com 13
  • 15. Logical Operators  And  Returns x if x is False , y otherwise  >> 2 and 3  3  or  Returns y if x is False , x otherwise  >> 2 or 3  2  not  Returns True if x is True , False otherwise  >> not 1  False verma.sameeksha90@gmail.com 15
  • 16. Bitwise Operators  a| b  Perform OR operation on each bit of the number  111 7  101 5  111 7  a & b  Perform AND operation on each bit of the number  111 7  101 5  101 5  a ^ b  Perform XOR operation on each bit of the number  111 7  101 5  010 2  a>>b  shift a right by b bits  3>>2 = 0  0011 0000  a<<b  shift a left by b bits  3<<2 = 12  0011 1100 verma.sameeksha90@gmail.com 16
  • 18. Identity Operators  is  True if the operands are identical (refer to the same object)  >> x = 5  >> x is 5  True  is not  True if the operands are not identical (do not refer to the same object)  >> x = 5  >> x is not 5  False verma.sameeksha90@gmail.com 18
  • 19. Membership Operators  x = [ 1,2,3,4,5]  In  True if it finds elements in the specified sequence  >> 3 in x  True  Not in  True if it does not finds elements in the specified sequence  >> 3 not in x  False verma.sameeksha90@gmail.com 19
  • 21. DATATYPE  Python is a loosely typed language. Therefore, no need to define the datatype of variables.  No need to declare variables before using them. verma.sameeksha90@gmail.com 21
  • 22. Datatype Immutable NUMBERS  Integer  Float  Complex  Strings  Tuples Mutable Lists Dictionaries Sets  Integer Example 1,4 etc 4+2=6 2**3=8  Float Example 1.4, 2.3 etc 4.0+2.5=6.5 6/2=3.0  Complex Example 1+4j etc (3+4j)+(1+1j)=4+5j (2+2j)*2=4+4j verma.sameeksha90@gmail.com 22
  • 23. Datatype Immutable  Numbers  STRINGS  Tuples Mutable Lists Dictionaries Sets  Strings are sequence of one- character strings  Example: 1. Sample = “Welcome to python Tutorial” 2. Sample = ‘Welcome to python Tutorial’  Multi-line strings can be denoted using triple quotes, “’ or “””  Example: 1. Sample = “”” It will help you lean Python fundamentals with examples in detail.””” verma.sameeksha90@gmail.com 23
  • 24. Sequence operations:  Concatenation:  ‘Python’ + ‘Tutorial’ ‘Python Tutorial’  Repetition:  ‘Stem’ * 2 ‘StemStem’  Slicing:  string1 = ‘Stem’ string1[2:4] ‘em’  Indexing:  string1 = ‘Stem’ string1[-1] +string[1] ‘ms’ verma.sameeksha90@gmail.com 24
  • 26.  Find  str = ‘Python’ str.find(‘on’) 4  Replaced()  str = ‘samee’ str.replace(‘ee’,’i’) ‘sami’  Split()  str = ‘S,A,M’ s.split(‘,’) [‘S’,’A’,’M’,]  Count()  str = ‘Python’ str.count(‘P’, beg=0,end=5) 1 verma.sameeksha90@gmail.com 26
  • 27.  Upper():  str = ‘Python’ str.upper() PYTHON  max()  str = ‘samee’ max(str) ‘s’  min()  str = ‘Python’ min(str) ‘P’  isalpha()  str = ‘Python’ str.isalpha() True verma.sameeksha90@gmail.com 27
  • 28. DATATYPE Immutable  Numbers  Strings  TUPLES Mutable Lists Dictionaries Sets  A tupples is a sequence of immutable Python objects like floating number, string literals etc  The tuples can’t be changed unlike lists.  Tuples are defined using curve braces. verma.sameeksha90@gmail.com 28
  • 29. Sequence operation:  Concatenation:  tup = (‘a’ , ’b’ , ’c’) tup+(‘d’ , ‘f’) (‘a’ , ’b’ , ’c’ , d’ , ‘f’)  Repetition:  tup = (‘a’ , ’b’ , ’c’) tup*2 (‘a’ , ’b’ , ’c’, ‘a’ , ’b’ , ’c’)  Slicing:  tup = (‘a’ , ’b’ , ’c’) tup[1:2] (’b’ , ’c’)  Indexing:  tup = (‘a’ , ’b’ , ’c’) tup[0] ‘a’ verma.sameeksha90@gmail.com 29
  • 31. DATATYPE Immutable  Numbers  Strings  Tuples Mutable  LISTS  Dictionaries  Sets  A lists is a sequence of mutable Python objects like floating number, string literals, etc.  The lists can be modified.  Tuples are defined using square braces. verma.sameeksha90@gmail.com 31
  • 32. Type Specific Method:  Append(value)  list = [1, ‘a’, 2.5] list.append(‘d’) [1 , ‘a’ , 2.5, ’d’]  Extend(list)  list = [1, ‘a’ ,2.5] list.extend ([‘c’ , ’d’]) [1, ’a’, 2.5, ’c’, ’d’]  Insert(index , value)  list = [1, ‘a’ ,2.5] list.insert(2,’b’) [1 , ‘a’ , ’b’, 2.5]  Pop()  list = [1, ‘a’ ,2.5] list.pop() [‘a’ , ’b’] verma.sameeksha90@gmail.com 32
  • 34. DATATYPE  Immutable  Numbers  Strings  Tuples  Mutable  Lists  DICTIONARIES  Sets  Dictionaries are perhaps the most flexible built-in data type in python.  Dictionaries, items are stored and fetched by key, instead of by positional offset. verma.sameeksha90@gmail.com 34
  • 35. Dictionary Examples  Empty dictionary  myDict={}  Dictionary with integer keys  myDict = {1:’apple’,2:’ball’}  Dictionary with mixed keys  myDict = {‘name’:’John’, 1:[2,4,3]}  From sequence having each item as a pair  myDict = dict([(1,’apple’),(2,’ball’)]) verma.sameeksha90@gmail.com 35
  • 36. Dictionary Methods  accessing dictionary  myDict = {1:’apple’,2:’ball’} myDict[1] ‘apple’  len()  myDict={1:’apple’,2:’ball’} len{myDict} 2  key()  myDict={1:’apple’’,2:’ball’} myDict.key() [1,2]  values()  myDict={1:’apple’’,2:’ball’} myDict.values() [‘apple,’ball]  items()  myDict={1:’apple’’,2:’ball’} myDict.items() [(1,’apple’),(2,ball)]  Get()  myDict={1:’apple’’,2:’ball’} myDict.get(1) ‘apple’  Update()  myDict={1:’a’,2:’b’} myDict.update({3:’c’}) {1:’a’,2:’b’,3:’c’}  Pop()  myDict={1:’apple’’,2:’ball’} myDict.pop(2) {1:’apple’} verma.sameeksha90@gmail.com 36
  • 38. DATATYPE Immutable Numbers Strings Tuples Mutable Lists Dictionaries SETS  A set is an unordered collection of items.  Every element is unique (no duplicates) and must be immutable (which cannot be changed). verma.sameeksha90@gmail.com 38
  • 39. Sets method  creating set  mySet = {1,2,3,3} {1,2,3}  union myS1={1,2,’c’} myS2={1,’b’,’c’} myS1| myS2 {1,2,’c’,’b’}  intersection myS1={1,2,’c’} myS2={1,’b’,’c’} myS1 & myS2 {1,’c’}  difference myS1 = {1,2,’c’} myS2={1,’b’,’c’} myS1-myS2 {2} verma.sameeksha90@gmail.com 39
  • 43. 1. If statement Syntax: if(condition): statement 1…… else: statement2…. verma.sameeksha90@gmail.com 43 START CHECK CONDITION EXECUTE BLOCK1 EXECUTE BLOCK2
  • 46. 3. while statement Syntax: while(condition is true): statement 1…… verma.sameeksha90@gmail.com 46 START CHECK CONDITION1 EXECUTE BLOCK1 EXIT LOOP REPEAT
  • 48. 4. For statement Syntax: for iterator name in iterating sequence: Execute statements... verma.sameeksha90@gmail.com 48 COUNT = 0 START Execute Statements Add 1 to Count repeat Check if Count < 10 EXIT LOOP
  • 50. 5. Break statement Syntax: Break verma.sameeksha90@gmail.com START Check loop Condition Execute Block Check break Condition EXIT LOOP EXIT LOOP Repeat 50
  • 52. 6. Continue Syntax: continue verma.sameeksha90@gmail.com 52 START Check loop Condition Skip Next Statement Check continue Condition EXIT LOOP Execute Block Repeat
  • 55. A function is a block of organized, reusable sets of instructions that is used to perform some related actions.  Why do we use functions?  Re-usability of code minimizes redundancy  Procedural decomposition makes things organized verma.sameeksha90@gmail.com 55
  • 56. USER DEFINED FUNCTION  SYNTAX: def func_name(arg1,arg2,arg3,…): Statements… return [expression]  Example: def add(a,b) Sum = a+b return sum verma.sameeksha90@gmail.com 56
  • 57.  Abs()  The abs function returns the absolute value of the specified number.  Syntax abs(x)  Example x=abs(3+5j)  All() verma.sameeksha90@gmail.com 57