Suche senden
Hochladen
Ch-4.pdf
•
0 gefällt mir
•
204 views
R
R.K.College of engg & Tech
Folgen
Python Programing
Weniger lesen
Mehr lesen
Ingenieurwesen
Melden
Teilen
Melden
Teilen
1 von 17
Jetzt herunterladen
Downloaden Sie, um offline zu lesen
Empfohlen
Python Programming
Python Programming
shahid sultan
Metasploit framework in Network Security
Metasploit framework in Network Security
Ashok Reddy Medikonda
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Edureka!
Python Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | Edureka
Edureka!
Unit 2 Java
Unit 2 Java
arnold 7490
discrete mathematics precedence of logical operators
discrete mathematics precedence of logical operators
Tukaram Gundoor
Java interfaces
Java interfaces
Raja Sekhar
Multithread Programing in Java
Multithread Programing in Java
M. Raihan
Empfohlen
Python Programming
Python Programming
shahid sultan
Metasploit framework in Network Security
Metasploit framework in Network Security
Ashok Reddy Medikonda
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Python Course | Python Programming | Python Tutorial | Python Training | Edureka
Edureka!
Python Class | Python Programming | Python Tutorial | Edureka
Python Class | Python Programming | Python Tutorial | Edureka
Edureka!
Unit 2 Java
Unit 2 Java
arnold 7490
discrete mathematics precedence of logical operators
discrete mathematics precedence of logical operators
Tukaram Gundoor
Java interfaces
Java interfaces
Raja Sekhar
Multithread Programing in Java
Multithread Programing in Java
M. Raihan
Control_Statements_in_Python.pptx
Control_Statements_in_Python.pptx
Koteswari Kasireddy
Ataques en redes lan
Ataques en redes lan
Jesus Vilchez
Understanding java streams
Understanding java streams
Shahjahan Samoon
Knowledge Representation in AI.pptx
Knowledge Representation in AI.pptx
Dr. Jasmine Beulah Gnanadurai
Java Streams
Java Streams
M Vishnuvardhan Reddy
Python
Python
Aashish Jain
Loop invariant computation
Loop invariant computation
ReachLocal Services India
Fundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
Metaploit
Metaploit
Ajinkya Pathak
Application layer
Application layer
Mukesh Chinta
Java Annotations
Java Annotations
Serhii Kartashov
Presentation on nesting of loops
Presentation on nesting of loops
bsdeol28
Vpn
Vpn
Ankit Anand
Loops and functions in r
Loops and functions in r
manikanta361
intro.pptx (1).pdf
intro.pptx (1).pdf
ANIKULSAIKH
3. Data types and Variables
3. Data types and Variables
Nilesh Dalvi
Constants, Variables, and Data Types
Constants, Variables, and Data Types
Rokonuzzaman Rony
Virtual Private Network
Virtual Private Network
HASHIR RAZA
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
dheeraj_cse
Introduction of tcp, ip & udp
Introduction of tcp, ip & udp
rahul kundu
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
jaychoudhary37
Types of Statements in Python Programming Language
Types of Statements in Python Programming Language
Explore Skilled
Weitere ähnliche Inhalte
Was ist angesagt?
Control_Statements_in_Python.pptx
Control_Statements_in_Python.pptx
Koteswari Kasireddy
Ataques en redes lan
Ataques en redes lan
Jesus Vilchez
Understanding java streams
Understanding java streams
Shahjahan Samoon
Knowledge Representation in AI.pptx
Knowledge Representation in AI.pptx
Dr. Jasmine Beulah Gnanadurai
Java Streams
Java Streams
M Vishnuvardhan Reddy
Python
Python
Aashish Jain
Loop invariant computation
Loop invariant computation
ReachLocal Services India
Fundamentals of Python Programming
Fundamentals of Python Programming
Kamal Acharya
Metaploit
Metaploit
Ajinkya Pathak
Application layer
Application layer
Mukesh Chinta
Java Annotations
Java Annotations
Serhii Kartashov
Presentation on nesting of loops
Presentation on nesting of loops
bsdeol28
Vpn
Vpn
Ankit Anand
Loops and functions in r
Loops and functions in r
manikanta361
intro.pptx (1).pdf
intro.pptx (1).pdf
ANIKULSAIKH
3. Data types and Variables
3. Data types and Variables
Nilesh Dalvi
Constants, Variables, and Data Types
Constants, Variables, and Data Types
Rokonuzzaman Rony
Virtual Private Network
Virtual Private Network
HASHIR RAZA
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
dheeraj_cse
Introduction of tcp, ip & udp
Introduction of tcp, ip & udp
rahul kundu
Was ist angesagt?
(20)
Control_Statements_in_Python.pptx
Control_Statements_in_Python.pptx
Ataques en redes lan
Ataques en redes lan
Understanding java streams
Understanding java streams
Knowledge Representation in AI.pptx
Knowledge Representation in AI.pptx
Java Streams
Java Streams
Python
Python
Loop invariant computation
Loop invariant computation
Fundamentals of Python Programming
Fundamentals of Python Programming
Metaploit
Metaploit
Application layer
Application layer
Java Annotations
Java Annotations
Presentation on nesting of loops
Presentation on nesting of loops
Vpn
Vpn
Loops and functions in r
Loops and functions in r
intro.pptx (1).pdf
intro.pptx (1).pdf
3. Data types and Variables
3. Data types and Variables
Constants, Variables, and Data Types
Constants, Variables, and Data Types
Virtual Private Network
Virtual Private Network
Interface in java By Dheeraj Kumar Singh
Interface in java By Dheeraj Kumar Singh
Introduction of tcp, ip & udp
Introduction of tcp, ip & udp
Ähnlich wie Ch-4.pdf
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
jaychoudhary37
Types of Statements in Python Programming Language
Types of Statements in Python Programming Language
Explore Skilled
Introduction to Python Part-1
Introduction to Python Part-1
Devashish Kumar
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
Aniruddha Paul
Exception handling.pptx
Exception handling.pptx
NISHASOMSCS113
Programming in Arduino (Part 2)
Programming in Arduino (Part 2)
Niket Chandrawanshi
Python session3
Python session3
Aswin Krishnamoorthy
Python Decision Making And Loops.pdf
Python Decision Making And Loops.pdf
NehaSpillai1
Ch-5.pdf
Ch-5.pdf
R.K.College of engg & Tech
Ch-5.pdf
Ch-5.pdf
R.K.College of engg & Tech
Python Flow Control
Python Flow Control
Mohammed Sikander
Cse lecture-6-c control statement
Cse lecture-6-c control statement
FarshidKhan
Loops
Loops
ShivamPatel466
INTERNSHIP REPORT.docx
INTERNSHIP REPORT.docx
21IT200KishorekumarI
Loops
Loops
Mohammed Alhafyan
Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1
Techglyphs
Basic of Python- Hands on Session
Basic of Python- Hands on Session
Dharmesh Tank
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
Asst.prof M.Gokilavani
python.pptx
python.pptx
Poornima116356
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
ParrotAI
Ähnlich wie Ch-4.pdf
(20)
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
FAL(2022-23)_FRESHERS_CSE1012_ETH_AP2022234000166_Reference_Material_I_15-Nov...
Types of Statements in Python Programming Language
Types of Statements in Python Programming Language
Introduction to Python Part-1
Introduction to Python Part-1
PYTHON FULL TUTORIAL WITH PROGRAMMS
PYTHON FULL TUTORIAL WITH PROGRAMMS
Exception handling.pptx
Exception handling.pptx
Programming in Arduino (Part 2)
Programming in Arduino (Part 2)
Python session3
Python session3
Python Decision Making And Loops.pdf
Python Decision Making And Loops.pdf
Ch-5.pdf
Ch-5.pdf
Ch-5.pdf
Ch-5.pdf
Python Flow Control
Python Flow Control
Cse lecture-6-c control statement
Cse lecture-6-c control statement
Loops
Loops
INTERNSHIP REPORT.docx
INTERNSHIP REPORT.docx
Loops
Loops
Bt0067 c programming and data structures 1
Bt0067 c programming and data structures 1
Basic of Python- Hands on Session
Basic of Python- Hands on Session
GE3151 UNIT II Study material .pdf
GE3151 UNIT II Study material .pdf
python.pptx
python.pptx
Introduction to Python for Data Science and Machine Learning
Introduction to Python for Data Science and Machine Learning
Mehr von R.K.College of engg & Tech
Module 5(Matplotlib and tkinter).pdf
Module 5(Matplotlib and tkinter).pdf
R.K.College of engg & Tech
Module 5(Numpy).pdf
Module 5(Numpy).pdf
R.K.College of engg & Tech
Module 5(Pandas).pdf
Module 5(Pandas).pdf
R.K.College of engg & Tech
Module IV_updated(old).pdf
Module IV_updated(old).pdf
R.K.College of engg & Tech
Module III.pdf
Module III.pdf
R.K.College of engg & Tech
Python_Module_2.pdf
Python_Module_2.pdf
R.K.College of engg & Tech
Python_Module_1.pdf
Python_Module_1.pdf
R.K.College of engg & Tech
Python for Data Analysis_ Data Wrangling with Pandas, Numpy, and Ipython ( PD...
Python for Data Analysis_ Data Wrangling with Pandas, Numpy, and Ipython ( PD...
R.K.College of engg & Tech
Ch-8.pdf
Ch-8.pdf
R.K.College of engg & Tech
Ch-3.pdf
Ch-3.pdf
R.K.College of engg & Tech
Creating Interface- Practice Program 6.docx
Creating Interface- Practice Program 6.docx
R.K.College of engg & Tech
Practice Program-9-Packages-Unit 4.docx
Practice Program-9-Packages-Unit 4.docx
R.K.College of engg & Tech
Unit-3 Practice Programs-5.docx
Unit-3 Practice Programs-5.docx
R.K.College of engg & Tech
Mehr von R.K.College of engg & Tech
(13)
Module 5(Matplotlib and tkinter).pdf
Module 5(Matplotlib and tkinter).pdf
Module 5(Numpy).pdf
Module 5(Numpy).pdf
Module 5(Pandas).pdf
Module 5(Pandas).pdf
Module IV_updated(old).pdf
Module IV_updated(old).pdf
Module III.pdf
Module III.pdf
Python_Module_2.pdf
Python_Module_2.pdf
Python_Module_1.pdf
Python_Module_1.pdf
Python for Data Analysis_ Data Wrangling with Pandas, Numpy, and Ipython ( PD...
Python for Data Analysis_ Data Wrangling with Pandas, Numpy, and Ipython ( PD...
Ch-8.pdf
Ch-8.pdf
Ch-3.pdf
Ch-3.pdf
Creating Interface- Practice Program 6.docx
Creating Interface- Practice Program 6.docx
Practice Program-9-Packages-Unit 4.docx
Practice Program-9-Packages-Unit 4.docx
Unit-3 Practice Programs-5.docx
Unit-3 Practice Programs-5.docx
Kürzlich hochgeladen
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
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
SIVASHANKAR N
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Suman Mia
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
KurinjimalarL3
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
Suhani Kapoor
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
Asst.prof M.Gokilavani
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
ranjana rawat
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
Asutosh Ranjan
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
ranjana rawat
result management system report for college project
result management system report for college project
Tonystark477637
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
upamatechverse
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
ssuser5c9d4b1
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
SIVASHANKAR N
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
ranjana rawat
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
Soham Mondal
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
Tsuyoshi Horigome
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
sivaprakash250
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
ranjana rawat
Kürzlich hochgeladen
(20)
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
MANUFACTURING PROCESS-II UNIT-2 LATHE MACHINE
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
VIP Call Girls Service Kondapur Hyderabad Call +91-8250192130
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
result management system report for college project
result management system report for college project
Introduction to Multiple Access Protocol.pptx
Introduction to Multiple Access Protocol.pptx
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
247267395-1-Symmetric-and-distributed-shared-memory-architectures-ppt (1).ppt
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
OSVC_Meta-Data based Simulation Automation to overcome Verification Challenge...
SPICE PARK APR2024 ( 6,793 SPICE Models )
SPICE PARK APR2024 ( 6,793 SPICE Models )
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
Ch-4.pdf
1.
Python Programming ing Problem
Solving Approach Reema Thareja 1 © OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 1
2.
© OXFORD UNIVERSITY
PRESS 2017. ALL RIGHTS RESERVED. 2 CHAPTER 4 Decision Control Statements
3.
© OXFORD UNIVERSITY
PRESS 2017. ALL RIGHTS RESERVED. 3 Control Statements A control statement is a statement that determines the control flow of a set of instructions, i.e., it decides the sequence in which the instructions in a program are to be executed. Types of Control Statements — • Sequential Control: A Python program is executed sequentially from the first line of the program to its last line. • Selection Control: To execute only a selected set of statements. • Iterative Control: To execute a set of statements repeatedly.
4.
If Statement © OXFORD
UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 4 Example:
5.
If-Else Statement © OXFORD
UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 5 Example:
6.
Nested if Statements ©
OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 6 A statement that contains other statements is called a compound statement. To perform more complex checks, if statements can be nested, that is, can be placed one inside the other. In such a case, the inner if statement is the statement part of the outer one. Nested if statements are used to check if more than one conditions are satisfied. Example:
7.
If-elif-else Statement © OXFORD
UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 7 Python supports if-elif-else statements to test additional conditions apart from the initial test expression. The if-elif-else construct works in the same way as a usual if- else statement. If-elif-else construct is also known as nested-if construct. Example:
8.
While Loop © OXFORD
UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 8 Example:
9.
For Loop © OXFORD
UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 9 For loop provides a mechanism to repeat a task until a particular condition is True. It is usually known as a determinate or definite loop because the programmer knows exactly how many times the loop will repeat. The for...in statement is a looping statement used in Python to iterate over a sequence of objects.
10.
For Loop and
Range() Function © OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 10 The range() function is a built-in function in Python that is used to iterate over a sequence of numbers. The syntax of range() is range(beg, end, [step]) The range() produces a sequence of numbers starting with beg (inclusive) and ending with one less than the number end. The step argument is option (that is why it is placed in brackets). By default, every number in the range is incremented by 1 but we can specify a different increment using step. It can be both negative and positive, but not zero. Examples:
11.
Range() Function © OXFORD
UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 11 If range() function is given a single argument, it produces an object with values from 0 to argument-1. For example: range(10) is equal to writing range(0, 10). • If range() is called with two arguments, it produces values from the first to the second. For example, range(0,10). • If range() has three arguments then the third argument specifies the interval of the sequence produced. In this case, the third argument must be an integer. For example, range(1,20,3). Examples:
12.
Condition-controlled and Counter-controlled
Loops © OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 12
13.
Nested Loops © OXFORD
UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 13 Python allows its users to have nested loops, that is, loops that can be placed inside other loops. Although this feature will work with any loop like while loop as well as for loop. A for loop can be used to control the number of times a particular set of statements will be executed. Another outer loop could be used to control the number of times that a whole loop is repeated. Loops should be properly indented to identify which statements are contained within each for statement. Example:
14.
The Break Statement ©
OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 14 The break statement is used to terminate the execution of the nearest enclosing loop in which it appears. The break statement is widely used with for loop and while loop. When compiler encounters a break statement, the control passes to the statement that follows the loop in which the break statement appears. Example:
15.
The Continue Statement ©
OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 15 Like the break statement, the continue statement can only appear in the body of a loop. When the compiler encounters a continue statement then the rest of the statements in the loop are skipped and the control is unconditionally transferred to the loop- continuation portion of the nearest enclosing loop. Example:
16.
The Pass Statement ©
OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 16 Pass statement is used when a statement is required syntactically but no command or code has to be executed. It specified a null operation or simply No Operation (NOP) statement. Nothing happens when the pass statement is executed. Difference between comment and pass statements In Python programming, pass is a null statement. The difference between a comment and pass statement is that while the interpreter ignores a comment entirely, pass is not ignored. Comment is not executed but pass statement is executed but nothing happens. Example:
17.
The Else Statement
Used With Loops © OXFORD UNIVERSITY PRESS 2017. ALL RIGHTS RESERVED. 17 Unlike C and C++, in Python you can have the else statement associated with a loop statements. If the else statement is used with a for loop, the else statement is executed when the loop has completed iterating. But when used with the while loop, the else statement is executed when the condition becomes false. Examples:
Jetzt herunterladen