<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python-3.4.3%2FC3%2FLoops%2FEnglish-timed</id>
		<title>Python-3.4.3/C3/Loops/English-timed - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python-3.4.3%2FC3%2FLoops%2FEnglish-timed"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C3/Loops/English-timed&amp;action=history"/>
		<updated>2026-04-13T10:32:56Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C3/Loops/English-timed&amp;diff=47738&amp;oldid=prev</id>
		<title>Pratik kamble: Created page with &quot;{| border=1 | '''Time'''  | '''Narration'''  |- | 00:01 | Welcome to the spoken tutorial on '''Loops'''.   |- | 00:05 | In this tutorial, we will learn to use,  '''for loop'''...&quot;</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python-3.4.3/C3/Loops/English-timed&amp;diff=47738&amp;oldid=prev"/>
				<updated>2019-06-11T05:47:51Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| border=1 | &amp;#039;&amp;#039;&amp;#039;Time&amp;#039;&amp;#039;&amp;#039;  | &amp;#039;&amp;#039;&amp;#039;Narration&amp;#039;&amp;#039;&amp;#039;  |- | 00:01 | Welcome to the spoken tutorial on &amp;#039;&amp;#039;&amp;#039;Loops&amp;#039;&amp;#039;&amp;#039;.   |- | 00:05 | In this tutorial, we will learn to use,  &amp;#039;&amp;#039;&amp;#039;for loop&amp;#039;&amp;#039;&amp;#039;...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
| '''Time''' &lt;br /&gt;
| '''Narration'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:01&lt;br /&gt;
| Welcome to the spoken tutorial on '''Loops'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:05&lt;br /&gt;
| In this tutorial, we will learn to use,&lt;br /&gt;
&lt;br /&gt;
'''for loop'''&lt;br /&gt;
&lt;br /&gt;
'''while loop'''&lt;br /&gt;
&lt;br /&gt;
'''break, continue '''and''' pass statements''' in the '''loops'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:18&lt;br /&gt;
| To record this tutorial, I am using &lt;br /&gt;
&lt;br /&gt;
'''Ubuntu Linux 16.04''' operating system&lt;br /&gt;
&lt;br /&gt;
'''Python 3.4.3 '''and&lt;br /&gt;
&lt;br /&gt;
'''IPython 5.1.0'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 00:34&lt;br /&gt;
|To practice this tutorial, you should know how to&lt;br /&gt;
&lt;br /&gt;
use''' conditional statements'''&lt;br /&gt;
&lt;br /&gt;
If not, see the relevant '''Python''' tutorials on this website.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|00:45&lt;br /&gt;
| Let us begin the tutorial with '''while loop'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|00:49&lt;br /&gt;
| The '''while loop''' is used to execute a set of '''statements''' as long as a condition is '''true.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|00:56&lt;br /&gt;
| When the condition becomes '''false''', program control passes to the line immediately after the '''loop'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|01:03&lt;br /&gt;
| The code inside the '''while loop '''should be indented four spaces to the right.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:09&lt;br /&gt;
| Let us start '''ipython.'''  Open the '''terminal.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:14&lt;br /&gt;
| Type '''ipython3 '''and press '''Enter.'''&lt;br /&gt;
&lt;br /&gt;
From here onwards, remember to press the '''Enter''' key after typing every command on the '''terminal'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:26&lt;br /&gt;
| Let us '''print''' the squares of all the odd numbers less than 10, using the '''while loop'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|01:32&lt;br /&gt;
| Type, '''i '''''is equal to''''' 1''' '''while i '''''less than '''''10 '''''colon'' '''print '''''inside brackets '''''i '''''asterisk '''''i''' '''i '''''plus equal to '''''2'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 01:50&lt;br /&gt;
| Here the '''while loop''' repeatedly checks the condition. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|01:54&lt;br /&gt;
| If it is '''True''', it '''executes''' the '''block''' of '''code '''within the '''loop'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|01:59&lt;br /&gt;
| Then press the '''Enter''' key twice to get the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:04&lt;br /&gt;
| Next let us now solve the same problem using '''for loop'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|02:09&lt;br /&gt;
| Type, '''for n in range '''''inside brackets '''''1, 10, 2 '''''colon'' '''print '''''inside brackets '''''n '''''asterisk '''''n'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|02:24&lt;br /&gt;
| As we know, the '''for loop''' iterates over a '''list''' or any other '''sequential data type'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|02:30&lt;br /&gt;
| So, we use the '''range '''function to''' '''get a list of odd numbers below 10 and iterate over it. Then we print the square of '''n'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:40&lt;br /&gt;
| Press '''Enter''' twice. We can see that we got the same output as before.  Note that now the lines of code are less.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:52&lt;br /&gt;
| Pause the video here. Try this exercise and then resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 02:58&lt;br /&gt;
| Write a '''while loop''' to print the squares of all the even numbers below 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:04&lt;br /&gt;
| Switch back to the '''terminal''' for the solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:08&lt;br /&gt;
| Type, '''i '''''is equal to''''' 2'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|03:12&lt;br /&gt;
| '''while i '''''less than''''' 10 '''''colon'' '''print '''''inside brackets '''''i '''''asterisk '''''i''' '''i '''''plus equal to '''''2'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|03:26&lt;br /&gt;
| Press the '''Enter '''key twice. We got the required output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:32&lt;br /&gt;
| Pause the video here. Try this exercise and then resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:39&lt;br /&gt;
| Write a '''for loop''' to print the squares of all the even numbers below 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:45&lt;br /&gt;
| Switch back to the '''terminal''' for the solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 03:49&lt;br /&gt;
| Type, '''for n in range '''''inside brackets''''' 2, 10, 2 '''''colon'' '''print '''''inside brackets''''' n''''' asterisk '''''n'''&lt;br /&gt;
&lt;br /&gt;
Press '''Enter''' twice. We got the required output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:09&lt;br /&gt;
| Next let us see at how to use the''' break, pass '''and '''continue''' keywords.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04:15&lt;br /&gt;
| Now type this code to understand the '''pass statement.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04:20&lt;br /&gt;
| As we already know, '''pass''' is just a '''placeholder'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:24&lt;br /&gt;
| It is used for the sake of completion of '''blocks''', that do not have any '''code''' within them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:31&lt;br /&gt;
| Nothing gets printed when we execute this code. Press '''Enter''' twice. As we expected nothing gets printed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:42&lt;br /&gt;
| Next let us understand about the '''break statement.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04:46&lt;br /&gt;
|'''break''' is used to break the innermost '''loop'''.  Type the code as shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|04:53&lt;br /&gt;
| Here, it will '''iterate '''each letter in the word '''python.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 04:58&lt;br /&gt;
| And it '''breaks '''the loop when '''h '''is the '''iteration''' value. Press '''Enter''' twice to see the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:07&lt;br /&gt;
| Next let us understand about the '''continue statement.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|05:12&lt;br /&gt;
|Type the code as shown. The''' continue statement''' rejects all the remaining '''statements''' in the current iteration of the '''loop'''.&lt;br /&gt;
And it moves the control back to the top of the '''loop'''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|05:27&lt;br /&gt;
| It will print the squares of all the odd numbers below 10 which are not multiples of 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:35&lt;br /&gt;
| Press '''Enter''' twice. We got the required output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 05:41&lt;br /&gt;
| This brings us to the end of this tutorial. Let us summarise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|05:47&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
'''Iterate''' over a '''sequence''' using '''for '''''and '''''while loops'''&lt;br /&gt;
&lt;br /&gt;
'''Break''' out of '''loops''' using '''break statement'''&lt;br /&gt;
&lt;br /&gt;
Skip '''iterations''' using '''continue statement'''&lt;br /&gt;
&lt;br /&gt;
Use the '''pass statement''' in a '''loop'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:05&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
Given '''range(1,4)''', write a '''code''' to '''print''' only the number 1.&lt;br /&gt;
&lt;br /&gt;
Which '''statement''' do you use to skip '''iterations'''? &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:24&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
We can use the '''break statement''' in the '''for loop''' as shown here&lt;br /&gt;
&lt;br /&gt;
In order to skip '''iterations''', we can use the '''continue statement'''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:37&lt;br /&gt;
| Please post your timed queries in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:41&lt;br /&gt;
| Please post your general queries on Python in this forum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:46&lt;br /&gt;
| FOSSEE team coordinates the TBC project.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 06:50&lt;br /&gt;
| Spoken Tutorial Project is funded by NMEICT, MHRD, Govt. of India. For more details, visit this website.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 07:00&lt;br /&gt;
| This is Priya from IIT Bombay signing off. Thanks for watching.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Pratik kamble</name></author>	</entry>

	</feed>