You are on page 1of 11

Week 3 Class 2

Student Worksheet

AÑO 2021
Scanning
Remember

Scanning is a reading strategy to find specific information quickly. When you scan a
text, you have a question in your mind and you read a passage only to find the
answer, ignoring information that does not relate to your question.

Exercise 1
You have three minutes to do the following. Use the text Python "while" Loops (Indefinite
Iteration).

1. Read the text and the table of contents.

2. Read the first two sentences of each paragraph.

3. Answer the questions at the end of the article.

Python "while" Loops (Indefinite


BookIteration)
Lover Semi Flat Illustrations made by Storyset:
By John Sturtz https://storyset.com/illustration/book-lover/pana
Table of Contents
The while Loop
The Python break and continue Statements
The else Clause
Infinite Loops
Nested while Loops
One-Line while Loops
Conclusion

El bucle while
Las declaraciones de Python rompen y continúan
La cláusula else
Bucles infinitos
Bucles while anidados
Bucles while de una línea
Conclusión
Iteration means executing the same block of code over and over, potentially many
times. A programming structure that implements iteration is called a loop.
La iteración significa ejecutar el mismo bloque de código una y otra vez,
potencialmente muchas veces. Una estructura de programación que implementa la
iteración se llama bucle.
In programming, there are two types of iteration, indefinite and definite:
With indefinite iteration, the number of times the loop is executed is not
specified explicitly in advance. Rather, the designated block is executed
repeatedly as long as some condition is met.
With definite iteration, the number of times the designated block will be
executed is specified explicitly at the time the loop starts.
In this tutorial, you’ll:
Learn about the while loop, the Python control structure used for
indefinite iteration
See how to break out of a loop or loop iteration prematurely
Explore infinite loops
When you’re finished, you should have a good grasp of how to use indefinite iteration
in Python.
Cuando haya terminado, debe tener una buena idea de cómo usar la iteración
indefinida en Python.

Part 1

1. What is the text about?


The text is about of the loop
2. What information does it give you?
there are two types of iteration: indefinite and definite
3. What are the key words in this part of the text?

loop indefinite

definite iteration
executed while

Exercise 2
Scan the following extract from the same text to find the answers to the questions. Remember, do
not focus on every word.

Infinite Loops

Suppose you write a while loop that theoretically never ends. Sounds weird, right?
Consider this example:
Python >>>

>>> while True:


... print('foo')
...
foo
foo
foo
.
.
.
foo
foo
foo
KeyboardInterrupt
Traceback (most recent call last):
File "<pyshell#2>", line 2, in <module>
print('foo')

This code was terminated by Ctrl + C which generates an interrupt from the keyboard.
Otherwise, it would have gone on unendingly. Many foo output lines have been removed
and replaced by the vertical ellipsis in the output shown. Clearly, True will never be false,
or we’re all in very big trouble. Thus, while True: initiates an infinite loop that will
theoretically run forever.
Maybe that doesn’t sound like something you’d want to do, but this pattern is actually
quite common. For example, you might write code for a service that starts up and runs
forever accepting service requests. “Forever” in this context means until you shut it down,
or until the heat death of the universe, whichever comes first. More prosaically,
remember that loops can be broken out of with the break statement. It may be more
straightforward to terminate a loop based on conditions recognized within the loop body,
rather than on a condition evaluated at the top.
Here’s another variant of the loop shown above that successively removes items from
a list using .pop() until it is empty:
Python >>>
>>> a = ['foo', 'bar', 'baz']
>>> while True:
... if not a:
... break
... print(a.pop(-1))
...
Bibliophile Flat Illustration made by Storyset:
https://storyset.com/illustration/bibliophile/rafiki
Part 1
Complete the title below with the information from the text presents in exercise 1 and 2:

Article Title:
Author:
Date of publication:
Website:
Topic:
Part 2
1. There is an action that causes an interrupt from the keyboard. What are the two keys that
terminated the code?
_____________________________________________________________________________

2. What pattern do they refer to in the section “…but this pattern is actually quite common”?
_____________________________________________________________________________

3. A synonym of the expression Until the heat death of the universe is


____________________________________________________________________________

4. The subtitle Infinite Loops in the table of contents is subtitle


number_____________
Part 3

Decide whether the following statements about the text Python "while" Loops (Indefinite
Iteration) are True or False. Tick the correct box.

Statements True False


a. Iteration means to execute the same block of code only once.
b. Definite and indefinite are two types of iteration in programming.
c. Specifying multiple break statements in a loop is not possible.
d. Sometimes it is necessary to end the infinite loop by breaking it out
from different locations.

Part 4

Vocabulary

Read the following words and decide whether they are nouns, adjectives, verbs, or adverbs:

infinite theoretically
condition an interrupt
break out true
remove termination
multiple unendingly
noun adjective verb adverb

Part 5

Word families

The words in the following table are taken from the reading Python "while" Loops (Indefinite
Iteration). Fill in the chart below with the correct word forms:

verb noun adjective adverb


Different/differing

educationally

research X

decision

Part 6

Word Stress

Put the following words from the text under the correct stress patterns. You can research the
meaning of the words using an online dictionary. Check the links below if you need:

✔ MacMillan Dictionary
✔ Collins Dictionary

infinite iteration
Termination multiple
condition termination
remove elipsis
developed activity
fundamental alternative

Ooo oOo ooOoo oOoo


remove

Don’t open the door__________ your journey.


Check your __________.
Listen to __________ information on the radio.
Take a __________ with you in the car.
Take bottles of __________
Take books, games, and __________ with you.
__________ that all the passengers in their car have their seat belt on.
Check that you have __________.

After driving for two hours, stop for __________ minutes.

Don’t use your __________.

You might also like