SlideShare a Scribd company logo
Python Programming
Unit – III (Part I)
(Lecture 17)
Updating variables
& Iteration
Python Programming
Unit – III (Part I)
(Lecture 17)
Updating variables & Iteration
Reassignment Updating variables
Updating variables & Iteration
Lecture 17
Lecture 18
Reassignment
Updating variables Break
Square roots
for & while statement
Lecture 17
Reassignment
Updating variables
Updating variables
• More than one assignment
to the same variable.
• A new assignment makes
an existing variable refer to
a new value (and stop
referring to the old value)
Reassignment
a = 5
Print (a) is 5
a = 6
Print (a) is 6
Lecture 17
Reassignment
Updating variables
Updating variables
Updating variables
• The new value of the
variable depends on
the old.
x = x + 1
• Get the current value
of x, add one, and then
update x with the new
value.
• Before you can update a
variable, you have to
initialize it, usually with
a simple assignment:
x = 5
x = x+1
Lecture 17
Reassignment
Updating variables
Updating variables
Python Programming
Unit – III (Part I)
(Lecture 18)
Updating variables
& Iteration
for & while statement
Python Programming
Unit – III (Part I)
(Lecture 18)
Updating variables & Iteration
Break Square roots
Lecture 17
Lecture 18
Reassignment
Updating variables Break
Square roots
for & while statement
Updating variables & Iteration
Iteration
Lecture 18
Break
Square roots
for & while statement
for & while statement
• Computers are often
used to automate
repetitive tasks.
• Repeating identical or
similar tasks without
making errors
• Two main loop
statements are
available.
for
while
Iteration
Lecture 18
Break
Square roots
for & while statement
Break
• The break is a keyword in
python which is used to
terminate the loop.
• It breaks the inner loop first
and then proceeds to outer
loops.
while True:
line = input('Enter line to print: ')
if line == 'Exit':
break
print (line)
Iteration
Lecture 18
Break
Square roots
for & while statement
Square roots
• Suppose that you want to know
the square root of a.
• Take x initially, compute a better
estimate with the following
formula:
Square roots
Square roots
Iteration
Lecture 18
Break
Square roots
for & while statement

More Related Content

PPTX
Activity selection problem class 12
PPTX
Activity selection problem
PPTX
Activity selection problem
PDF
Priorty queue
PPSX
CS106 Lab 10 - Functions (passing by value)
PPTX
01 part7 properties pure substance more prob
PPTX
String Matching (Naive,Rabin-Karp,KMP)
PPSX
CS106 Lab 11 - Functions (passing by reference)
Activity selection problem class 12
Activity selection problem
Activity selection problem
Priorty queue
CS106 Lab 10 - Functions (passing by value)
01 part7 properties pure substance more prob
String Matching (Naive,Rabin-Karp,KMP)
CS106 Lab 11 - Functions (passing by reference)

What's hot (20)

PPSX
CS106 Lab 6 - While and Do..While loop
PPTX
Lecture4
PPSX
CS106 Lab 8 - Nested loops
PPT
Concept of c
PPTX
Labreportofai
PPT
Counting Sort Lowerbound
PPT
lecture 5
PPT
Introduction to design and analysis of algorithm
PPT
Heaps & Adaptable priority Queues
PPTX
Counting sort
PPTX
Evaluation of prefix expression with example
PPT
Summing the squares of a number's digits
PPTX
Counting sort
PPTX
Arithmetic and Arithmetic assignment operators
PPTX
Activities on Software Development
PDF
201707 CSE110 Lecture 29
PPTX
Data structures Lecture no.6
PDF
Linked list
PPTX
Algorithms - "heap sort"
CS106 Lab 6 - While and Do..While loop
Lecture4
CS106 Lab 8 - Nested loops
Concept of c
Labreportofai
Counting Sort Lowerbound
lecture 5
Introduction to design and analysis of algorithm
Heaps & Adaptable priority Queues
Counting sort
Evaluation of prefix expression with example
Summing the squares of a number's digits
Counting sort
Arithmetic and Arithmetic assignment operators
Activities on Software Development
201707 CSE110 Lecture 29
Data structures Lecture no.6
Linked list
Algorithms - "heap sort"
Ad

Similar to Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration | (20)

PPTX
Python variable assignments | JNTUA | R19 | UNIT 1
PPTX
python ppt.pptx
PPTX
Lecture 1- Python.pptxjhhhfdzdfdggcfffff
PPTX
Year 7 lesson 3 variables and while loops
PPTX
Python programming –part 3
PPTX
Python Lecture 5
PPTX
Bikalpa_Thapa_Python_Programming_(Basics).pptx
PDF
python.pdf
PPTX
python BY ME-2021python anylssis(1).pptx
PPTX
made it easy: python quick reference for beginners
PPTX
Lecture Introduction to Python 2024.pptx
PDF
Introduction to Python Programming | InsideAIML
PDF
3-Python Python oho pytho hdiwefjhdsjhds
PDF
Python Lecture Slides Variables and Assignments
PDF
python notes.pdf
PDF
pythonQuick.pdf
PDF
python 34💭.pdf
PPTX
python_computer engineering_semester_computer_language.pptx
PPTX
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
Python variable assignments | JNTUA | R19 | UNIT 1
python ppt.pptx
Lecture 1- Python.pptxjhhhfdzdfdggcfffff
Year 7 lesson 3 variables and while loops
Python programming –part 3
Python Lecture 5
Bikalpa_Thapa_Python_Programming_(Basics).pptx
python.pdf
python BY ME-2021python anylssis(1).pptx
made it easy: python quick reference for beginners
Lecture Introduction to Python 2024.pptx
Introduction to Python Programming | InsideAIML
3-Python Python oho pytho hdiwefjhdsjhds
Python Lecture Slides Variables and Assignments
python notes.pdf
pythonQuick.pdf
python 34💭.pdf
python_computer engineering_semester_computer_language.pptx
VARIABLES AND DATA TYPES IN PYTHON NEED TO STUDY
Ad

More from FabMinds (20)

PPTX
Python Programming | JNTUA | UNIT 3 | Lists |
PPTX
Python Programming | JNTUA | UNIT 3 | Strings |
PPTX
Python Programming | JNTUA | UNIT 2 | Case Study |
PPTX
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
PPTX
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
PPTX
Application layer protocols
PPTX
Internet connectivity
PPTX
Introduction for internet connectivity (IoT)
PPTX
web connectivity in IoT
PPTX
message communication protocols in IoT
PPTX
web communication protocols in IoT
PPTX
introduction for web connectivity (IoT)
PPTX
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
PPTX
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
PPTX
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
PPTX
Data enrichment
PPTX
Communication technologies
PPTX
M2M systems layers and designs standardizations
PPTX
Business models for business processes on IoT
PPTX
Python Programming | JNTUK | UNIT 1 | Lecture 5
Python Programming | JNTUA | UNIT 3 | Lists |
Python Programming | JNTUA | UNIT 3 | Strings |
Python Programming | JNTUA | UNIT 2 | Case Study |
Python Programming | JNTUA | UNIT 2 | Fruitful Functions |
Python Programming | JNTUA | UNIT 2 | Conditionals and Recursion |
Application layer protocols
Internet connectivity
Introduction for internet connectivity (IoT)
web connectivity in IoT
message communication protocols in IoT
web communication protocols in IoT
introduction for web connectivity (IoT)
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Introduction | JNTUA | R19 | UNIT 1 | Functions
Python Programming | JNTUK | UNIT 2 | Lecture 6 & 7 | Conditional & Control S...
Data enrichment
Communication technologies
M2M systems layers and designs standardizations
Business models for business processes on IoT
Python Programming | JNTUK | UNIT 1 | Lecture 5

Recently uploaded (20)

PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
102 student loan defaulters named and shamed – Is someone you know on the list?
PDF
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
PDF
VCE English Exam - Section C Student Revision Booklet
PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PDF
Pre independence Education in Inndia.pdf
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PPTX
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
PDF
O5-L3 Freight Transport Ops (International) V1.pdf
PPTX
Cell Types and Its function , kingdom of life
PDF
Abdominal Access Techniques with Prof. Dr. R K Mishra
PPTX
Final Presentation General Medicine 03-08-2024.pptx
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Insiders guide to clinical Medicine.pdf
PPTX
Institutional Correction lecture only . . .
PDF
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
PPTX
master seminar digital applications in india
PDF
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PDF
FourierSeries-QuestionsWithAnswers(Part-A).pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
102 student loan defaulters named and shamed – Is someone you know on the list?
Chapter 2 Heredity, Prenatal Development, and Birth.pdf
VCE English Exam - Section C Student Revision Booklet
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
Pre independence Education in Inndia.pdf
Week 4 Term 3 Study Techniques revisited.pptx
Introduction to Child Health Nursing – Unit I | Child Health Nursing I | B.Sc...
O5-L3 Freight Transport Ops (International) V1.pdf
Cell Types and Its function , kingdom of life
Abdominal Access Techniques with Prof. Dr. R K Mishra
Final Presentation General Medicine 03-08-2024.pptx
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Insiders guide to clinical Medicine.pdf
Institutional Correction lecture only . . .
Origin of periodic table-Mendeleev’s Periodic-Modern Periodic table
master seminar digital applications in india
The Lost Whites of Pakistan by Jahanzaib Mughal.pdf
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
FourierSeries-QuestionsWithAnswers(Part-A).pdf

Python Programming | JNTUA | UNIT 3 | Updating Variables & Iteration |