0% found this document useful (0 votes)
2 views1 page

It Ration

This document introduces the concept of iteration in programming, emphasizing its importance for executing repetitive tasks. It discusses how iteration is applied to collections like lists and strings, allowing for the processing of individual items or characters. Examples of practical applications include updating bank balances, sending emails, and displaying information in software.

Uploaded by

azansaid436
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views1 page

It Ration

This document introduces the concept of iteration in programming, emphasizing its importance for executing repetitive tasks. It discusses how iteration is applied to collections like lists and strings, allowing for the processing of individual items or characters. Examples of practical applications include updating bank balances, sending emails, and displaying information in software.

Uploaded by

azansaid436
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

3/2/22, 8:45 PM 7.1.

Introduction: Iteration — Foundations of Python Programming

7.1. Introduction: Iteration


A basic building block of all programs is to be able to repeat some code over and over again. Whether it is
updating the bank balances of millions of customers each night, or sending email messages to thousands
of people programming involves instructing the computer to do many repetitive actions. In computing, we
refer to this repetitive execution as iteration. In this section, we will explore some mechanisms for basic
iteration.

With collections (lists and strings), a lot of computations involve processing one item at a time. For strings,
this means that we would like to process one character at a time. Often we start at the beginning, select
each character in turn, do something to it, and continue until the end. For example, we could take each
character and substitute for the character 13 characters away in the alphabet to create a coded message.

This pattern of processing is called a traversal, or iteration over the characters. Similarly, we can process
each of the items in a list, one at a time, iterating over the items in the list. This has applications in every
piece of software you can imagine:

Displaying a list of friends on SnapChat


Updating the position of every character on the screen of a video game
Displaying the locations that Doctors Without Borders operates in

You have attempted 1 of 1 activities on this page

([Link])

([Link])

 Completed. Well Done!

© Copyright 2017 bradleymiller. Created using Runestone ([Link] 5.5.17. | Back to top

[Link] 1/1

You might also like