<?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/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Minal</id>
		<title>Script | Spoken-Tutorial - User contributions [en]</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Minal"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Special:Contributions/Minal"/>
		<updated>2026-04-10T12:33:57Z</updated>
		<subtitle>User contributions</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-8/English-timed</id>
		<title>PHP-and-MySQL/C3/MySQL-Part-8/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-8/English-timed"/>
				<updated>2013-01-02T12:33:35Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00 |Welcome back! In our previous tutorial, we have established what we are going to change and how we are going to change it. |- |0:08 |We did…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|Welcome back! In our previous tutorial, we have established what we are going to change and how we are going to change it.&lt;br /&gt;
|-&lt;br /&gt;
|0:08&lt;br /&gt;
|We did go through that.&lt;br /&gt;
|-&lt;br /&gt;
|0:10&lt;br /&gt;
|So, now I will test my code. &lt;br /&gt;
|-&lt;br /&gt;
|0:12&lt;br /&gt;
|If we look at our database, we have a few records here.&lt;br /&gt;
|-&lt;br /&gt;
|0:18&lt;br /&gt;
|I am going to delete David's record here because it was from another tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|0:23&lt;br /&gt;
|After the deletion, we have the records of Alex, Kyle, Emily and Dale &lt;br /&gt;
|-&lt;br /&gt;
|0:28&lt;br /&gt;
|Here I will use Kyle's record as an example and change it to a particular value.&lt;br /&gt;
|-&lt;br /&gt;
|0:33&lt;br /&gt;
|We will refresh our page and make sure it is updated.&lt;br /&gt;
|-&lt;br /&gt;
|0:38&lt;br /&gt;
|I will select &amp;quot;Kyle&amp;quot; and I will  change this to &amp;quot;Karen&amp;quot; and I will click on &amp;quot;Change&amp;quot; and here everything has disappeared.&lt;br /&gt;
|-&lt;br /&gt;
|0:45&lt;br /&gt;
|Now we will come back into our table and click on &amp;quot;Browse&amp;quot; to refresh it.&lt;br /&gt;
|-&lt;br /&gt;
|0:50&lt;br /&gt;
|we will scroll down and find that nothing has changed.&lt;br /&gt;
|-&lt;br /&gt;
|0:57&lt;br /&gt;
|I think I made a mistake. My mistake was that it was &amp;quot;name&amp;quot; before and now I will change this to &amp;quot;value&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|1:05&lt;br /&gt;
|This needs to be set to &amp;quot;value&amp;quot; instead of &amp;quot;name&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|1:09&lt;br /&gt;
|&amp;quot;value&amp;quot; holds the value... of anything here that has been selected; so the value is &amp;quot;id&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:15&lt;br /&gt;
|When we submit our form, it will come through and the value will be contained within here in &amp;quot;id&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:24&lt;br /&gt;
|So, I found and fixed the problem and now I will go back and refresh.&lt;br /&gt;
|-&lt;br /&gt;
|1:30&lt;br /&gt;
|Here I will once again change &amp;quot;Kyle&amp;quot; to &amp;quot;Karen&amp;quot;. By clicking on &amp;quot;Change&amp;quot; you can see that nothing has happened.&lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|Even when I enter my database, we can see that we have got Alex, Kyle, Emily and Dale. &lt;br /&gt;
|-&lt;br /&gt;
|1:42&lt;br /&gt;
|Since we had changed &amp;quot;Kyle&amp;quot; to &amp;quot;Karen&amp;quot;, our id should have shown the changes.&lt;br /&gt;
|-&lt;br /&gt;
|1:47&lt;br /&gt;
|But when we click on &amp;quot;Browse&amp;quot;  and scroll down, we can  see that &amp;quot;Kyle&amp;quot; has now been replaced by &amp;quot;Karen&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:53&lt;br /&gt;
|Hence, you can also update values using forms. &lt;br /&gt;
|-&lt;br /&gt;
|1:57&lt;br /&gt;
|It is very easy, as long as you have a standard knowledge of &lt;br /&gt;
* php software, &lt;br /&gt;
* how to manipulate things, &lt;br /&gt;
* how to check things, &lt;br /&gt;
* how to use if statements, &lt;br /&gt;
* passing variables, &lt;br /&gt;
* particularly the posting variables etc.&lt;br /&gt;
|-&lt;br /&gt;
|2:15&lt;br /&gt;
|You will be able to learn all this, as long as you learn the basic set of these tutorials.&lt;br /&gt;
|-&lt;br /&gt;
|2:20&lt;br /&gt;
|As of now, in this tutorial, you have learnt inserting and updating and so on so forth. &lt;br /&gt;
|-&lt;br /&gt;
|2:28&lt;br /&gt;
|The last thing I will show you is how to delete.&lt;br /&gt;
|-&lt;br /&gt;
|2:33&lt;br /&gt;
|To show you how to Delete, I will close this page and  and remove this box and edit this. &lt;br /&gt;
|-&lt;br /&gt;
|2:45&lt;br /&gt;
|I will replace &amp;quot;Change&amp;quot; with &amp;quot;Delete&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|Here I will be deleting records where we have a particular name shown.&lt;br /&gt;
|-&lt;br /&gt;
|2:55&lt;br /&gt;
|To do this, I will add &amp;quot;lastname&amp;quot; over here.&lt;br /&gt;
|-&lt;br /&gt;
|3:00&lt;br /&gt;
|Let us  not resend that and let us go back to &amp;quot;mysql.php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:07&lt;br /&gt;
|Here we now have &amp;quot;Alex Garrett&amp;quot;, &amp;quot;Karen Headen&amp;quot; which has been changed or modified from my last example.&lt;br /&gt;
|-&lt;br /&gt;
|3:17&lt;br /&gt;
|We will click &amp;quot;Karen Headen&amp;quot; and we will click on &amp;quot;Delete&amp;quot;. This will delete the record.&lt;br /&gt;
|-&lt;br /&gt;
|3:23&lt;br /&gt;
|But it has not been deleted at the moment.&lt;br /&gt;
|-&lt;br /&gt;
|3:26&lt;br /&gt;
|Let us make sure all our records are intact first.&lt;br /&gt;
|-&lt;br /&gt;
|3:30&lt;br /&gt;
|As you can see here, we have all our records intact and I will choose to delete a particular record.&lt;br /&gt;
|-&lt;br /&gt;
|3:38&lt;br /&gt;
|Let us say delete &amp;quot;Emily Headen&amp;quot;, so I will choose the record of Emily Headen to be deleted.&lt;br /&gt;
|-&lt;br /&gt;
|3:44&lt;br /&gt;
|Now we need to submit this to a new page called &amp;quot;mysql underscore delete.php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:51&lt;br /&gt;
|For this, we are going to create a new page save as mysql underscore delete.php &lt;br /&gt;
|-&lt;br /&gt;
|3:58&lt;br /&gt;
|We will do exactly the same as we had done before.&lt;br /&gt;
|-&lt;br /&gt;
|4:02&lt;br /&gt;
|We are going to &amp;quot;require&amp;quot; our connect so we need to connect to the database. &lt;br /&gt;
|-&lt;br /&gt;
|4:10&lt;br /&gt;
|Oh Sorry!  Let us get that back to &amp;quot;require connect.php&amp;quot; and we will again take the variables in.&lt;br /&gt;
|-&lt;br /&gt;
|4:22&lt;br /&gt;
|So let us type &amp;quot;todelete&amp;quot; here and that is &amp;quot;equal to&amp;quot; again a &amp;quot;POST&amp;quot; variable here.&lt;br /&gt;
|-&lt;br /&gt;
|4:29&lt;br /&gt;
|We are posting this form to this page and let us change some values over here.&lt;br /&gt;
|-&lt;br /&gt;
|4:34&lt;br /&gt;
|Let us say &amp;quot;todelete&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:37&lt;br /&gt;
|So we have changed our &amp;quot;select name&amp;quot; to &amp;quot;todelete&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:41&lt;br /&gt;
|Now, if you have a look back on this form here, I will show you the code again. &lt;br /&gt;
|-&lt;br /&gt;
|4:46&lt;br /&gt;
|Here we can see that we have our name values and our id value here for each case of each record. &lt;br /&gt;
|-&lt;br /&gt;
|4:53&lt;br /&gt;
|If we refresh, the name of our form is &amp;quot;todelete&amp;quot; and we are taking that into account for each value.&lt;br /&gt;
|-&lt;br /&gt;
|5:01&lt;br /&gt;
|If Emily's record has been selected we will delete the record where the id is equal to 3.&lt;br /&gt;
|-&lt;br /&gt;
|5:08&lt;br /&gt;
|Let us go back to our code and here we have our POST variable.&lt;br /&gt;
|-&lt;br /&gt;
|5:13&lt;br /&gt;
|Now I am going to echo out to give you an example of how it is processed.&lt;br /&gt;
|-&lt;br /&gt;
|5:19&lt;br /&gt;
|We have Emily Headen here. We have 3 there which means that we can use this to delete the id 3 in the database or rather the table.&lt;br /&gt;
|-&lt;br /&gt;
|5:30&lt;br /&gt;
|Here, again we will create a new variable and I will call it &amp;quot;mysql underscore query&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|5:41&lt;br /&gt;
|Inside here we will use a whole new set of commands.&lt;br /&gt;
|-&lt;br /&gt;
|5:45&lt;br /&gt;
|We will type in &amp;quot;DELETE FROM&amp;quot; and obviously we will specify our table.&lt;br /&gt;
|-&lt;br /&gt;
|5:51&lt;br /&gt;
|Let us type &amp;quot;people&amp;quot; and &amp;quot;WHERE id equals &amp;quot;todelete&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|5:56&lt;br /&gt;
|The &amp;quot;todelete&amp;quot; variable which is the id of the person that we selected from this list.&lt;br /&gt;
|-&lt;br /&gt;
|6:02&lt;br /&gt;
|Now let us test this. Let us say Emily Headen.&lt;br /&gt;
|-&lt;br /&gt;
|6:08&lt;br /&gt;
|Let us check in our database if Emily Headen's record still exists. &lt;br /&gt;
|-&lt;br /&gt;
|6:13&lt;br /&gt;
|Let us refresh to see if the record still exists.&lt;br /&gt;
|-&lt;br /&gt;
|6:18&lt;br /&gt;
|When I click on &amp;quot;Emily Headen&amp;quot; and click on &amp;quot;Delete&amp;quot;, nothing has happened.&lt;br /&gt;
|-&lt;br /&gt;
|6:21&lt;br /&gt;
|We have not echoed out but when we click on &amp;quot;Browse&amp;quot; to refresh, we can see that Emily's record has been deleted from the database.&lt;br /&gt;
|-&lt;br /&gt;
|6:30&lt;br /&gt;
|So in this set of tutorials, I have shown you a basic serve command like&lt;br /&gt;
* how to insert data &lt;br /&gt;
* how to read data&lt;br /&gt;
* how to modify&lt;br /&gt;
* how to delete data and &lt;br /&gt;
* how to incorporate into html forms.&lt;br /&gt;
|-&lt;br /&gt;
|6:43&lt;br /&gt;
|If I have forgotten anything, please let me know and I will add it as parts of these tutorials.&lt;br /&gt;
|-&lt;br /&gt;
|6:49&lt;br /&gt;
|Make sure you subscribe for updates from my channel. &lt;br /&gt;
|-&lt;br /&gt;
|6:53&lt;br /&gt;
|I hope you enjoyed these tutorials. Thanks for watching.&lt;br /&gt;
|-&lt;br /&gt;
|6:55&lt;br /&gt;
|This is Evan Varkey dubbing for the Spoken Tutorial Project. (Script contributed by Juanita Jayakar).&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-7/English-timed</id>
		<title>PHP-and-MySQL/C3/MySQL-Part-7/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-7/English-timed"/>
				<updated>2013-01-02T12:32:50Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00 |In this part of the tutorial, I am going to give you a chance to create a simple program.  |- |0:06 |This program will allow us to select a…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|In this part of the tutorial, I am going to give you a chance to create a simple program. &lt;br /&gt;
|-&lt;br /&gt;
|0:06&lt;br /&gt;
|This program will allow us to select a name from a list.&lt;br /&gt;
|-&lt;br /&gt;
|0:15&lt;br /&gt;
|Also it will allow us to update a piece of information and I am selecting the ability to update the name itself.&lt;br /&gt;
|-&lt;br /&gt;
|0:25&lt;br /&gt;
|I will say the &amp;quot;firstname&amp;quot; in this for example.  &lt;br /&gt;
|-&lt;br /&gt;
|0:28&lt;br /&gt;
|Here, we can select from a list and then update that information.&lt;br /&gt;
|-&lt;br /&gt;
|0:33&lt;br /&gt;
|I will modify this page a little bit to get rid of some information which we do not need.&lt;br /&gt;
|- &lt;br /&gt;
|0:38&lt;br /&gt;
|We don't need this echoing here.&lt;br /&gt;
|-&lt;br /&gt;
|0:40&lt;br /&gt;
|We are also going to change our form here, so we don't need this for now.&lt;br /&gt;
|-&lt;br /&gt;
|0:47&lt;br /&gt;
|Let us delete that.&lt;br /&gt;
|-&lt;br /&gt;
|0:48&lt;br /&gt;
|We are not going to  need this either. &lt;br /&gt;
|-&lt;br /&gt;
|0:52&lt;br /&gt;
|We will only need the firstname and lastname. Date of birth and gender don't really matter.&lt;br /&gt;
|-&lt;br /&gt;
|0:59&lt;br /&gt;
|Let us delete this too.We don't need this either.... neither this.&lt;br /&gt;
|-&lt;br /&gt;
|1:04&lt;br /&gt;
|Ok there we are.&lt;br /&gt;
|-&lt;br /&gt;
|1:05&lt;br /&gt;
|This tutorial is not going to be exhaustive and is not going to be completely correct either. &lt;br /&gt;
|-&lt;br /&gt;
|1:14&lt;br /&gt;
|However it is going to show you how to apply your records to html select boxes. &lt;br /&gt;
|-&lt;br /&gt;
|1:22&lt;br /&gt;
|And also showing  you how to update information based on what you selected.&lt;br /&gt;
|-&lt;br /&gt;
|1:31&lt;br /&gt;
|As you see here, I am going to create some data inside the '''while loop'''. &lt;br /&gt;
|-&lt;br /&gt;
|1:45&lt;br /&gt;
|We are going to create some html data here.&lt;br /&gt;
|-&lt;br /&gt;
|1:47&lt;br /&gt;
|Here I am echoing out. Let me just stop here for the time being.&lt;br /&gt;
|-&lt;br /&gt;
|1:55&lt;br /&gt;
|Lets go down here.&lt;br /&gt;
|-&lt;br /&gt;
|1:57&lt;br /&gt;
|We are going to create a select area which is a select box. &lt;br /&gt;
|-&lt;br /&gt;
|2:01&lt;br /&gt;
|It is a drop down box and for each of these boxes, we have an option.&lt;br /&gt;
|-&lt;br /&gt;
|2:14&lt;br /&gt;
|For example this could be 1 or 2.&lt;br /&gt;
|-&lt;br /&gt;
|2:15&lt;br /&gt;
|So lets come back here and  &amp;quot;refresh button&amp;quot;. Lets refresh this. &lt;br /&gt;
|-&lt;br /&gt;
|2:27&lt;br /&gt;
|Let us get rid of this dialogue box.&lt;br /&gt;
|-&lt;br /&gt;
|2:30&lt;br /&gt;
|Here we have got 1 or 2. This is the piece of html here.&lt;br /&gt;
|-&lt;br /&gt;
|2:35&lt;br /&gt;
|Here we are going to apply this and we are going to search for our records. We are going to give a name.......... in each of these option boxes.&lt;br /&gt;
|-&lt;br /&gt;
|2:40&lt;br /&gt;
|I will give an option name to each record that we found.&lt;br /&gt;
|-&lt;br /&gt;
|2:43&lt;br /&gt;
|If you don't understand this, it means inside the code which is going to be repeated for every record, outside the loop, over here, we want to echo the first part of our html code.&lt;br /&gt;
|-&lt;br /&gt;
|3:00&lt;br /&gt;
|This will be &amp;quot;select&amp;quot; and the name of that is going to be &amp;quot;name&amp;quot;.&lt;br /&gt;
|- &lt;br /&gt;
|3:08&lt;br /&gt;
|Or rather let me call it '''people name'''.&lt;br /&gt;
|-&lt;br /&gt;
|3:13&lt;br /&gt;
|After this, outside of our while  loop, here we are going to echo out the ends tag. So  let us type  forward slash and select&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:21&lt;br /&gt;
|The reason for not incorporating this inside our while loop is because if it is repeating, then it is going to repeat the start and the end tags and not the option part, which we need.&lt;br /&gt;
|-&lt;br /&gt;
|3:36&lt;br /&gt;
|Here the option part goes inside the loop.&lt;br /&gt;
|-&lt;br /&gt;
|3:39&lt;br /&gt;
|Let me echo out, lets say the &amp;quot;firstname&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:41&lt;br /&gt;
|And what this does is, for every record, it is going to echo this option code&lt;br /&gt;
|-&lt;br /&gt;
|3:48&lt;br /&gt;
|And if you remember down here, we had &amp;quot;option&amp;quot; and &amp;quot;option end&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:52&lt;br /&gt;
|This was being  repeated over and over again. &lt;br /&gt;
|-&lt;br /&gt;
|3:56&lt;br /&gt;
|Now we have the &amp;quot;select&amp;quot; part here and the &amp;quot;select end&amp;quot; here.&lt;br /&gt;
|-&lt;br /&gt;
|3:58&lt;br /&gt;
|We need this echoed once, this echoed once and these echoed for every record in the database or in the table.&lt;br /&gt;
|-&lt;br /&gt;
|4:10&lt;br /&gt;
|You can verify this by refreshing. &lt;br /&gt;
|-&lt;br /&gt;
|4:12&lt;br /&gt;
|Oh! Where's our code gone?&lt;br /&gt;
|-&lt;br /&gt;
|4:14&lt;br /&gt;
|Looks go back and find where the mistake is.  Actually we need to change this part here - the &amp;quot;if&amp;quot; statement.&lt;br /&gt;
|-&lt;br /&gt;
|4:25&lt;br /&gt;
|We are not looking for our &amp;quot;submit&amp;quot; button anymore, so we can delete that.&lt;br /&gt;
|-&lt;br /&gt;
|4:28&lt;br /&gt;
|So now, presuming everything is alright, we will refresh and we have a list box of all the first names of the records in our database.&lt;br /&gt;
|-&lt;br /&gt;
|4:39&lt;br /&gt;
|Now I want to make this look better and so I will say &amp;quot;surname&amp;quot; or &amp;quot;lastname&amp;quot; in the code.&lt;br /&gt;
|-&lt;br /&gt;
|4:46&lt;br /&gt;
|There you go!  Refresh.  This is a really easy way to use html code, is'nt it?&lt;br /&gt;
|-&lt;br /&gt;
|4:52&lt;br /&gt;
|Now we are going to talk about &amp;quot;option&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:52&lt;br /&gt;
|We need to have a name for each option and the name for each one will be &amp;quot;id&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|5:00&lt;br /&gt;
|If I click on refresh and come on to my page source, you can see that we got 1,2,3,4, in each one here.&lt;br /&gt;
|-&lt;br /&gt;
|5:13&lt;br /&gt;
|This is really useful because now we can update, unique records rather than just going by the name.&lt;br /&gt;
|-&lt;br /&gt;
|5:23&lt;br /&gt;
|So  here, I will start to create my update form.&lt;br /&gt;
|-&lt;br /&gt;
|5:27&lt;br /&gt;
|I will put an input box after my &amp;quot;select&amp;quot;, and this is going to be &amp;quot;text&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|The name will be '''to change'''. This is what we are going to change by.&lt;br /&gt;
|-&lt;br /&gt;
| 5:40&lt;br /&gt;
|Next we will create another button or another input element called the '''submit''' button whose value will  be &amp;quot;change&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|5:53&lt;br /&gt;
|Here I will just change the first name for now. Just for an example.&lt;br /&gt;
|-&lt;br /&gt;
|5:58&lt;br /&gt;
|So here is the basis of our form.&lt;br /&gt;
|-&lt;br /&gt;
|6:00&lt;br /&gt;
|We have got the &amp;quot;name&amp;quot; here and what we want to change it to. &lt;br /&gt;
|-&lt;br /&gt;
|6:04&lt;br /&gt;
|So here I will change it from &amp;quot;Alex&amp;quot; to &amp;quot;Alexander&amp;quot; and then click on '''Change'''.&lt;br /&gt;
|-&lt;br /&gt;
|6:10&lt;br /&gt;
|At the moment nothing is happening.&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
|Now what we need to do is put this inside the form so that I can end my form.&lt;br /&gt;
|-&lt;br /&gt;
|6:18&lt;br /&gt;
|Over here, it is getting kind of messy but hopefully you can see whats going on. &lt;br /&gt;
|-&lt;br /&gt;
|6:23&lt;br /&gt;
|Let me scroll down over here.  Up here we need to start our form.&lt;br /&gt;
|-&lt;br /&gt;
|6:22&lt;br /&gt;
|The action will be the page we are on at the moment which is &amp;quot;mysql dot php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|6:33&lt;br /&gt;
|Infact I will do it on another page. &lt;br /&gt;
|-&lt;br /&gt;
|6:36&lt;br /&gt;
|So rename it to &amp;quot;mysql update dot php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|6:40&lt;br /&gt;
|This will make it a bit easier for you to see and a lot easier for me to write.&lt;br /&gt;
|-&lt;br /&gt;
|6:45&lt;br /&gt;
|Then by refreshing that, we can see that we go to the new page which isn't found at the moment.&lt;br /&gt;
|-&lt;br /&gt;
|6:52&lt;br /&gt;
|I am going to create that inside here.&lt;br /&gt;
|-&lt;br /&gt;
|6:55&lt;br /&gt;
|We will save that straight away as &amp;quot;mysql underscore update dot php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|7:00&lt;br /&gt;
|We need to start our php tags.&lt;br /&gt;
|-&lt;br /&gt;
|7:02&lt;br /&gt;
|We need to require our &amp;quot;connect dot php&amp;quot; because we are connecting to our database again.&lt;br /&gt;
|-&lt;br /&gt;
|7:14&lt;br /&gt;
|We also need to get our value of the name that we are changing.&lt;br /&gt;
|-&lt;br /&gt;
|7:17&lt;br /&gt;
|So we will call our select name '''peoplename'''. &lt;br /&gt;
|-&lt;br /&gt;
|7:20&lt;br /&gt;
|So here we will type &amp;quot;peoplename&amp;quot; equals POST and  '''peoplename'''.&lt;br /&gt;
|-&lt;br /&gt;
|7:28&lt;br /&gt;
|That is the name of the html element we are taking.&lt;br /&gt;
|-&lt;br /&gt;
|7:32&lt;br /&gt;
|This is going to be called 1,2,3.&lt;br /&gt;
|-&lt;br /&gt;
|7:36&lt;br /&gt;
|This is our id which is inside our database. &lt;br /&gt;
|-&lt;br /&gt;
|7:39&lt;br /&gt;
|&amp;quot;tochange&amp;quot; is the field in which we have ready to type our new value in.&lt;br /&gt;
|-&lt;br /&gt;
|7:46&lt;br /&gt;
|Here I will code a brief '''if statement''' just to say if '''peoplename''' and '''tochange'''.&lt;br /&gt;
|-&lt;br /&gt;
|7:57&lt;br /&gt;
|This makes sure that we have got both our values there.&lt;br /&gt;
|- &lt;br /&gt;
|8:00&lt;br /&gt;
|Then what we will do is type &amp;quot;change&amp;quot; equals &amp;quot;mysql query&amp;quot; and that is simply &amp;quot;UPDATE people&amp;quot;, which is the name of our table here.&lt;br /&gt;
|-&lt;br /&gt;
|8:17&lt;br /&gt;
|&amp;quot;UPDATE people SET firstname equals tochange&amp;quot; where &amp;quot;firstname equals&amp;quot;....&lt;br /&gt;
|-&lt;br /&gt;
|8:30&lt;br /&gt;
|No, in fact we are not..... We are changing it by &amp;quot;id&amp;quot;, isn't it?&lt;br /&gt;
|-&lt;br /&gt;
|8:39&lt;br /&gt;
|So we type where the &amp;quot;ID&amp;quot; is equal to the value of this &amp;quot;peoplename&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|8:52&lt;br /&gt;
|Right, lets go back.  &lt;br /&gt;
|-&lt;br /&gt;
|8:57&lt;br /&gt;
|Lets say I picked &amp;quot;Kyle&amp;quot; to change the name of &amp;quot;Kyle&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|9:02&lt;br /&gt;
|The name of this is 2 so the &amp;quot;peoplename&amp;quot; is also 2. &lt;br /&gt;
|-&lt;br /&gt;
|9:05&lt;br /&gt;
|So we are changing this to this where the id is this.&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
|I will show you that in the next part of tutorial because I am running out of time.&lt;br /&gt;
|-&lt;br /&gt;
|9:14&lt;br /&gt;
|So I will see you there soon.  This is Evan Varkey dubbing for the Spoken Tutorial Project. (Script contributed by Juanita Jayakar).&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-5/English-timed</id>
		<title>PHP-and-MySQL/C3/MySQL-Part-5/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-5/English-timed"/>
				<updated>2013-01-02T12:31:16Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:0 |Welcome to mySQL part 5. To echo our data to the user and to display the results from this, we'll need to use &amp;quot;while&amp;quot; statement. |- |0:12 |A…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:0&lt;br /&gt;
|Welcome to mySQL part 5. To echo our data to the user and to display the results from this, we'll need to use &amp;quot;while&amp;quot; statement.&lt;br /&gt;
|-&lt;br /&gt;
|0:12&lt;br /&gt;
|As I mentioned, we have created a row variable and this is &amp;quot;=mysql_fetch_assoc&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|0:19&lt;br /&gt;
|This is creating an associative array from our &amp;quot;extract&amp;quot; query which is here.&lt;br /&gt;
|-&lt;br /&gt;
|0:25&lt;br /&gt;
|So we are selecting everything in the &amp;quot;people&amp;quot; table and ordering them by &amp;quot;id&amp;quot; in ascending order.&lt;br /&gt;
|-&lt;br /&gt;
|0:33&lt;br /&gt;
|Inside our WHILE since we wrote row as an array and its an associative array, row[0] will be wrong because these are numeric.&lt;br /&gt;
|-&lt;br /&gt;
|0:46&lt;br /&gt;
|These are numeric id tags and instead of this we'll use our fieldnames, since this is associative.&lt;br /&gt;
|-&lt;br /&gt;
|1:00&lt;br /&gt;
|So, instead of 0 1 2 3 4, we'll be using the actual name.&lt;br /&gt;
|-&lt;br /&gt;
|1:07&lt;br /&gt;
|Lets create variables from this. Let me say id and then firstname equals, we are using the same structure throughout.&lt;br /&gt;
|-&lt;br /&gt;
|1:16&lt;br /&gt;
|So its quite easy to copy and paste this.&lt;br /&gt;
|-&lt;br /&gt;
|1:19&lt;br /&gt;
|Lets indent this.&lt;br /&gt;
|-&lt;br /&gt;
|1:24&lt;br /&gt;
|So we have 5 altogether.&lt;br /&gt;
|-&lt;br /&gt;
|1:28&lt;br /&gt;
|So that's five and then lets just change. This is a lazy act!&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
|But its just a lot quicker to do this way.&lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|So lastname and we have the date of birth. We also have the gender.&lt;br /&gt;
|-&lt;br /&gt;
|1:47&lt;br /&gt;
|We have all our data and now how do we use this?&lt;br /&gt;
|-&lt;br /&gt;
|1:51&lt;br /&gt;
|We need to use the &amp;quot;echo&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
|1:55&lt;br /&gt;
|There might be a loop inside the middle, at the moment. So anything we echo out will be repeated.&lt;br /&gt;
|-&lt;br /&gt;
|1:59&lt;br /&gt;
|Every record we have and that's right, too. We'll repeat this code.&lt;br /&gt;
|-&lt;br /&gt;
|2:03&lt;br /&gt;
|For example, I say text here. There are currently 4 records.&lt;br /&gt;
|-&lt;br /&gt;
|2:12&lt;br /&gt;
|After refreshing this page, you should see text echoed out 4 times.&lt;br /&gt;
|-&lt;br /&gt;
|2:17&lt;br /&gt;
|By typing out 4 times, this piece of code here represents every loop.&lt;br /&gt;
|-&lt;br /&gt;
|2:23&lt;br /&gt;
|Therefore we can incorporate for example, id or firstname or any other, that we have extracted from the database using our associative array.&lt;br /&gt;
|-&lt;br /&gt;
|2:33&lt;br /&gt;
|Now I'll write firstname lastname was born on dob for date of birth and is and I'll put gender up there.&lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|Not forgetting our linebreak. I'll refresh our page. &lt;br /&gt;
|-&lt;br /&gt;
|2:55&lt;br /&gt;
|Then we have our set of data structured using the variable names. &lt;br /&gt;
|-&lt;br /&gt;
|3:02&lt;br /&gt;
|We have given in the correct order and also it has been repeated through for every record we have.&lt;br /&gt;
|-&lt;br /&gt;
|3:06&lt;br /&gt;
|Okay, we have just given out the content of our table using this star, declared by this asterisk, where it collects every single data or every record.&lt;br /&gt;
|-&lt;br /&gt;
|3:20&lt;br /&gt;
|Now let me do this. I'll say IF gender==F then gender=female.&lt;br /&gt;
|-&lt;br /&gt;
|3:36&lt;br /&gt;
|The actual spelling of that and then let us say else gender=male. This is just rewriting the variable depending on the value.&lt;br /&gt;
|-&lt;br /&gt;
|3:50&lt;br /&gt;
|If we refresh now, we can see this has changed to male male and female female. We also have some interesting ways of displaying this data.&lt;br /&gt;
|-&lt;br /&gt;
|3:59&lt;br /&gt;
|At the moment I'm selecting from the people table and ordering by id and ascending order.&lt;br /&gt;
|-&lt;br /&gt;
|4:06&lt;br /&gt;
|I can also order by descending id. You can see that this switches this data around. &lt;br /&gt;
|-&lt;br /&gt;
|4:16&lt;br /&gt;
|We can also order it by firstname. This will put this in descending alphabetical order and ascending will put this in ascending alphabetical order.&lt;br /&gt;
|-&lt;br /&gt;
|4:32&lt;br /&gt;
|So we got A D E and K.&lt;br /&gt;
|-&lt;br /&gt;
|4:34&lt;br /&gt;
|You can do the same with the surname.&lt;br /&gt;
|-&lt;br /&gt;
|4:36&lt;br /&gt;
|You could do the same with anything. Even Date of birth, as long as you include this over here. &lt;br /&gt;
|-&lt;br /&gt;
|4:44&lt;br /&gt;
|Another thing to do is, let me just take this back to id and have this as descending. We can use this limit 1 or we can say limit 2, 3 or 4.&lt;br /&gt;
|-&lt;br /&gt;
|4:57&lt;br /&gt;
|Now I'll limit 1 for the purpose of this.&lt;br /&gt;
|-&lt;br /&gt;
|4:59&lt;br /&gt;
|Now lets have 1 to let the user of the page know the last person that was inserted into this table.&lt;br /&gt;
|-&lt;br /&gt;
|5:10&lt;br /&gt;
|So I say &amp;quot;echo&amp;quot; here.&lt;br /&gt;
|-&lt;br /&gt;
|5:13&lt;br /&gt;
|echo last person to be inserted into table was and I'll leave it like that and add a linebreak. &lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|I'll just echo out the first and last name. Ok?&lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|So, here we can see that there is a lot of confusion.&lt;br /&gt;
|-&lt;br /&gt;
|5:37&lt;br /&gt;
|Last person to be inserted. Yes, in fact it does work!&lt;br /&gt;
|-&lt;br /&gt;
|5:40&lt;br /&gt;
|It is already typed in the &amp;quot;limit&amp;quot; command.&lt;br /&gt;
|-&lt;br /&gt;
|5:42&lt;br /&gt;
|What I've done is by limiting this by 1 in descending order of id - the id is incremental - I get 4 at the top and if we are limiting it by 1, 4 will be the only record that is selected. &lt;br /&gt;
|-&lt;br /&gt;
|6:02&lt;br /&gt;
|Therefore, the last person in the table, as per the last record displayed, will have its value echoed out. &lt;br /&gt;
|-&lt;br /&gt;
|6:09&lt;br /&gt;
|This &amp;quot;while&amp;quot; will only return 1 data value.&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
|Since we are returning 1 data value here, we are confused by these.&lt;br /&gt;
|-&lt;br /&gt;
|6:17&lt;br /&gt;
|This is one command here, &amp;quot;select * from people&amp;quot;, &amp;quot;order by id decs&amp;quot; is another and &amp;quot;limit 1&amp;quot; is yet another. &lt;br /&gt;
|-&lt;br /&gt;
|6:26&lt;br /&gt;
|We don't use commas or anything. This is just how we write our code inside our query.&lt;br /&gt;
|-&lt;br /&gt;
|6:36&lt;br /&gt;
|Okay, just to test this code, I'll insert just using the &amp;quot;insert&amp;quot; function in php myadmin and I'll insert another record.&lt;br /&gt;
|-&lt;br /&gt;
|6:44&lt;br /&gt;
|For example, lets type in &amp;quot;David Green&amp;quot; and our date of birth could be random.&lt;br /&gt;
|-&lt;br /&gt;
|6:53&lt;br /&gt;
|It doesn't really matter what we type in here. We say male. &lt;br /&gt;
|-&lt;br /&gt;
|7:00&lt;br /&gt;
|I come down here and submit this data.&lt;br /&gt;
|-&lt;br /&gt;
|7:02&lt;br /&gt;
|Click on browse and we have a new value here. &lt;br /&gt;
|-&lt;br /&gt;
|7:03&lt;br /&gt;
|When we come back here and refresh, that will change to &amp;quot;David Green&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|7:11&lt;br /&gt;
|So this is really useful if you have a website in which your putting videos or personal pictures. &lt;br /&gt;
|-&lt;br /&gt;
|7:18&lt;br /&gt;
|You can just place in the last thing the user had inserted. &lt;br /&gt;
|-&lt;br /&gt;
|7:21&lt;br /&gt;
|Or may be the last person that has been registered on your website or anything. &lt;br /&gt;
|-&lt;br /&gt;
|7:26&lt;br /&gt;
|Possibility of using this is endless.&lt;br /&gt;
|-&lt;br /&gt;
|7:28&lt;br /&gt;
|Basically how to echo out data and how to manipulate it by just using mysql query.&lt;br /&gt;
|-&lt;br /&gt;
|7:35&lt;br /&gt;
|In the next part, we will allow our user to specify which data they want to show.&lt;br /&gt;
|-&lt;br /&gt;
|7:45&lt;br /&gt;
|We will create some html forms and to enable them to do this.&lt;br /&gt;
|-&lt;br /&gt;
|7:50&lt;br /&gt;
|This will let them select a name from the database or table of their choice.&lt;br /&gt;
|-&lt;br /&gt;
|7:55&lt;br /&gt;
|So, join me in the next part.&lt;br /&gt;
|-&lt;br /&gt;
|8:03&lt;br /&gt;
|Bye for now.  This is Juanita Jayakar dubbing for the Spoken Tutorial Project&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-2/English-timed</id>
		<title>PHP-and-MySQL/C3/MySQL-Part-2/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-2/English-timed"/>
				<updated>2013-01-02T12:29:10Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:0 |Hi. In the first part of the tutorial we created a table inside our database &amp;quot;php academy&amp;quot; and we created our fields with all the relevant d…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:0&lt;br /&gt;
|Hi. In the first part of the tutorial we created a table inside our database &amp;quot;php academy&amp;quot; and we created our fields with all the relevant data to go with it...  datatypes etc.&lt;br /&gt;
|-&lt;br /&gt;
|0:14&lt;br /&gt;
|Now we will insert some dummy data inside our database by doing this.&lt;br /&gt;
|-&lt;br /&gt;
|0:21&lt;br /&gt;
|I'll not click this &amp;quot;Insert&amp;quot; button here because by clicking this button here, we get very easy to use interface where we can type in firstname, lastname, date of birth using the calender function over here.&lt;br /&gt;
|-&lt;br /&gt;
|0:33&lt;br /&gt;
|You can see that just popped up.&lt;br /&gt;
|-&lt;br /&gt;
|0:35&lt;br /&gt;
|And we can also enter our gender here.&lt;br /&gt;
|-&lt;br /&gt;
|0:37&lt;br /&gt;
|As this is mysql php tutorial, I'll show you how to insert data using mysql or php.&lt;br /&gt;
|-&lt;br /&gt;
|0:49&lt;br /&gt;
|Now first of all we need to connect to our database.&lt;br /&gt;
|-&lt;br /&gt;
|0:52&lt;br /&gt;
|Under &amp;quot;mysql dot php&amp;quot; file, we will use the &amp;quot;include&amp;quot; function to include our file &amp;quot;connect dot php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:00&lt;br /&gt;
|Now if this is not in the same directory, you know that you can say &amp;quot;sub directory and then connect&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:07&lt;br /&gt;
|Please specify this properly.&lt;br /&gt;
|-&lt;br /&gt;
|1:09&lt;br /&gt;
|If you dont want the page to execute... if you don't want the &amp;quot;Rest of the page&amp;quot; to execute here, you can use the &amp;quot;require&amp;quot; function.&lt;br /&gt;
|-&lt;br /&gt;
|1:18&lt;br /&gt;
|The &amp;quot;require&amp;quot; function kills the page if this isn't found from here on.&lt;br /&gt;
|-&lt;br /&gt;
|1:23&lt;br /&gt;
|The &amp;quot;include&amp;quot; will include it and then it will continue to echo or continue to run the rest of the page.&lt;br /&gt;
|-&lt;br /&gt;
|1:29&lt;br /&gt;
|If you use the &amp;quot;require&amp;quot; function, it will in fact &amp;quot;kill&amp;quot; if this cannot be included.&lt;br /&gt;
|-&lt;br /&gt;
|1:34&lt;br /&gt;
|So what I will say is &amp;quot;require connect dot php&amp;quot; just to say that if you can't connect to the database, the rest of this page is meaningless.&lt;br /&gt;
|-&lt;br /&gt;
|1:41&lt;br /&gt;
|We will get loads of rubbish upon the page.&lt;br /&gt;
|-&lt;br /&gt;
|1:44&lt;br /&gt;
|ok... so if &amp;quot;require connect dot php&amp;quot; and inside connect dot php we need to start our php mysql functions.&lt;br /&gt;
|-&lt;br /&gt;
|1:52&lt;br /&gt;
|Firstly you need to know - we will start with our variable called &amp;quot;connect&amp;quot; and this will use the function &amp;quot;mysql_connect&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|2:01&lt;br /&gt;
|That's the first function you need to learn.&lt;br /&gt;
|-&lt;br /&gt;
|2:03&lt;br /&gt;
|Its a very very important function that enables you to connect to your database mysql.&lt;br /&gt;
|-&lt;br /&gt;
|2:08&lt;br /&gt;
|This takes 3 parameters.&lt;br /&gt;
|-&lt;br /&gt;
|2:11&lt;br /&gt;
|The first one here is the webserver itself - the address of the webserver.&lt;br /&gt;
|-&lt;br /&gt;
|2:17&lt;br /&gt;
|I'll use my computer at the moment with a local webserver with my local host.&lt;br /&gt;
|-&lt;br /&gt;
|2:22&lt;br /&gt;
|This can also be written as 127.0.0.1 if you wish, as a substitute for local host.&lt;br /&gt;
|-&lt;br /&gt;
|2:32&lt;br /&gt;
|I prefer typing &amp;quot;local host&amp;quot; personally.&lt;br /&gt;
|-&lt;br /&gt;
|2:35&lt;br /&gt;
|Now I'll use the standard username and password given to me.&lt;br /&gt;
|-&lt;br /&gt;
|2:41&lt;br /&gt;
|This is &amp;quot;root&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|2:42&lt;br /&gt;
|My password doesn't exist because I don't have a password. &lt;br /&gt;
|-&lt;br /&gt;
|2:50&lt;br /&gt;
|We have established our connection but what happens if this connection is not initialized properly.&lt;br /&gt;
|-&lt;br /&gt;
|2:56&lt;br /&gt;
|What we can do after this, is write &amp;quot;or die&amp;quot; and in brackets we can specify an error message for example &amp;quot;connection failed&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:02&lt;br /&gt;
|So lets presume at the moment this connection works.&lt;br /&gt;
|-&lt;br /&gt;
|3:11&lt;br /&gt;
|I'll echo out a piece of code saying &amp;quot;connected&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:18&lt;br /&gt;
|Ok now if this does connect successfully the rest of the script will run and echo out &amp;quot;connected&amp;quot; otherwise it would just give you this text and won't run the rest of the page.&lt;br /&gt;
|-&lt;br /&gt;
|3:26&lt;br /&gt;
|So what I will do is, I will open backup here.&lt;br /&gt;
|-&lt;br /&gt;
|3:30&lt;br /&gt;
|Refresh and you can see &amp;quot;connect dot php&amp;quot; and &amp;quot;mysql dot php&amp;quot; and I'll click on mysql dot php.&lt;br /&gt;
|-&lt;br /&gt;
|3:37&lt;br /&gt;
|The reason I'm not clicking connect is because inside mysql we require &amp;quot;connect dot php&amp;quot; anyway.&lt;br /&gt;
|-&lt;br /&gt;
|3:44&lt;br /&gt;
|So as long as these are both saved, we can just run mysql dot php.&lt;br /&gt;
|-&lt;br /&gt;
|3:48&lt;br /&gt;
|We have connected successfully.&lt;br /&gt;
|-&lt;br /&gt;
|3:50&lt;br /&gt;
|Now if I were to say change this to something like &amp;quot;I dont exist&amp;quot; then we get a connection error because that host name doesn't exist, .... at least on this computer.&lt;br /&gt;
|-&lt;br /&gt;
|4:08&lt;br /&gt;
|I can refresh and .... its taking a long time...... ok there we are.&lt;br /&gt;
|-&lt;br /&gt;
|4:14&lt;br /&gt;
|You can see that we have got mysql error here and we have connection failed text just here, that we specified earlier.&lt;br /&gt;
|-&lt;br /&gt;
|4:21&lt;br /&gt;
|Ok.. so we have got unknown mysql server host.&lt;br /&gt;
|-&lt;br /&gt;
|4:25&lt;br /&gt;
|If you ever get this error you know what to look out for.&lt;br /&gt;
|-&lt;br /&gt;
|4:27&lt;br /&gt;
|This is the host I specified and you can see what line its on and all our usual debugging message code.&lt;br /&gt;
|-&lt;br /&gt;
|4:36&lt;br /&gt;
|So lets presume that I...ummm.... in fact what I can do first is show you another useful thing or &amp;quot;die&amp;quot; you can also specify another function here.&lt;br /&gt;
|-&lt;br /&gt;
|4:46&lt;br /&gt;
|This is the second function that you should learn.&lt;br /&gt;
|-&lt;br /&gt;
|4:50&lt;br /&gt;
|Its &amp;quot;mysql error&amp;quot; - just put brackets like that - and  when we refresh our page keeping the &amp;quot;I don't exist&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:57&lt;br /&gt;
|We can refresh and its taking its time.....&lt;br /&gt;
|-&lt;br /&gt;
|5:06&lt;br /&gt;
|Ok there we are.&lt;br /&gt;
|-&lt;br /&gt;
|5:07&lt;br /&gt;
|What we have basically done is we echoed out the same error message that php has given us anyway.&lt;br /&gt;
|-&lt;br /&gt;
|5:12&lt;br /&gt;
|However if your.. ummm.... how do I say - if your error reporting is turned off for your user, this will give out what you want.&lt;br /&gt;
|-&lt;br /&gt;
|5:24&lt;br /&gt;
|Now we don't echo out this to the user.&lt;br /&gt;
|-&lt;br /&gt;
|5:26&lt;br /&gt;
|lets say we go up here and say &amp;quot;error reporting&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|5:30&lt;br /&gt;
|Please see the error reporting tutorial I made, if you haven't. &lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|If you have...ummm.... set this to '0'.&lt;br /&gt;
|-&lt;br /&gt;
|5:40&lt;br /&gt;
|This will turn off all error reporting.&lt;br /&gt;
|-&lt;br /&gt;
|5:43&lt;br /&gt;
|So what happens is this error here will be ignored but our specific error will be given out to the user.&lt;br /&gt;
|-&lt;br /&gt;
|5:49&lt;br /&gt;
|Lets refresh here.... again its taking its time...so I apologize....&lt;br /&gt;
|-&lt;br /&gt;
|5:58&lt;br /&gt;
|There you go.  We can just say that we got our specific error out there, ok?&lt;br /&gt;
|-&lt;br /&gt;
|6:03&lt;br /&gt;
|Presuming that we have connected successfully using this function and if not, then we have given out this error message, the next thing to do is to select our database&lt;br /&gt;
|-&lt;br /&gt;
|6:13&lt;br /&gt;
|To do this, we use the &amp;quot;mysql_select db&amp;quot; function.&lt;br /&gt;
|-&lt;br /&gt;
|6:20&lt;br /&gt;
|This takes exactly 1 parameter and that's the name of your database.&lt;br /&gt;
|-&lt;br /&gt;
|6:24&lt;br /&gt;
|So we click on &amp;quot;php myadmin&amp;quot; again, we can see that our database name is &amp;quot;phpacademy&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|6:31&lt;br /&gt;
|So if I just type &amp;quot;phpacademy&amp;quot; this should work.&lt;br /&gt;
|-&lt;br /&gt;
|6:36&lt;br /&gt;
|Again we could use this or die feature.&lt;br /&gt;
|-&lt;br /&gt;
|6:40&lt;br /&gt;
|Using our die function we can specify a mysql_error if it doesn't exist or anything like that.&lt;br /&gt;
|-&lt;br /&gt;
|6:47&lt;br /&gt;
|So lets refresh this.&lt;br /&gt;
|-&lt;br /&gt;
|6:50&lt;br /&gt;
|In fact I'll change this back to &amp;quot;local host&amp;quot; because I'm getting back on track here and then lets refresh.&lt;br /&gt;
|-&lt;br /&gt;
|6:59&lt;br /&gt;
|So that's connected and if this is not found we are giving out a mysql_error.&lt;br /&gt;
|-&lt;br /&gt;
|7:04&lt;br /&gt;
|Lets try that - &amp;quot;I don't exist&amp;quot; and refresh and &amp;quot;Unknown database &amp;quot;idon'texist&amp;quot;&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|7:12&lt;br /&gt;
|This is working well.&lt;br /&gt;
|-&lt;br /&gt;
|7:14&lt;br /&gt;
|Its quite useful to have these errors and then we can get users to report back if they don't exist.&lt;br /&gt;
|-&lt;br /&gt;
|7:20&lt;br /&gt;
|So its &amp;quot;phpacademy&amp;quot; there.&lt;br /&gt;
|-&lt;br /&gt;
|7:23&lt;br /&gt;
|I presume everything is ok and lets refresh.&lt;br /&gt;
|-&lt;br /&gt;
|7:29&lt;br /&gt;
|Change this back to &amp;quot;phpacademy&amp;quot; and save that.&lt;br /&gt;
|-&lt;br /&gt;
|7:33&lt;br /&gt;
|Refresh and we have been connected successfully. &lt;br /&gt;
|-&lt;br /&gt;
|7:36&lt;br /&gt;
|What I'll do is keep a log of this and say that I am connected successfully.&lt;br /&gt;
|-&lt;br /&gt;
|7:41&lt;br /&gt;
|I'll end our paragraph after this to continue with the rest of our code.&lt;br /&gt;
|-&lt;br /&gt;
|7:42&lt;br /&gt;
|Next thing is to write some data to our database which we will cover in our next tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|7:56&lt;br /&gt;
|See you soon!  This is Juanita Jayakar dubbing for the Spoken Tutorial Project.&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-1/English-timed</id>
		<title>PHP-and-MySQL/C3/MySQL-Part-1/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C3/MySQL-Part-1/English-timed"/>
				<updated>2013-01-02T12:27:43Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |00:00 |Hi everyone! |- |00:01 |This is a pure My SQL php tutorial. |- |00:07 |I will teach you the basics of connecting, retrieving data, handlin…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|00:00&lt;br /&gt;
|Hi everyone!&lt;br /&gt;
|-&lt;br /&gt;
|00:01&lt;br /&gt;
|This is a pure My SQL php tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|00:07&lt;br /&gt;
|I will teach you the basics of connecting, retrieving data, handling errors and modifying data.&lt;br /&gt;
|- &lt;br /&gt;
|00:15&lt;br /&gt;
|So that will cover some SQL code and some SQL queries.&lt;br /&gt;
|-&lt;br /&gt;
|00:21&lt;br /&gt;
|Ok! Lets start.&lt;br /&gt;
|-&lt;br /&gt;
|00:24&lt;br /&gt;
|Here I am going to show the directory structure of &amp;quot;mysql&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|00:27&lt;br /&gt;
|and we will create a couple of files here.&lt;br /&gt;
|-&lt;br /&gt;
|00:29&lt;br /&gt;
|I will create the first file and call it &amp;quot;connect.php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|00:34&lt;br /&gt;
|I will come here, click on the folder called &amp;quot;mysql&amp;quot; and Save this as &amp;quot;connect.php&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
|00:40&lt;br /&gt;
|Now here we will create a separate file and include with every page that we use.&lt;br /&gt;
|-&lt;br /&gt;
|00:46&lt;br /&gt;
|This is a lot easier to connect to your database&lt;br /&gt;
|-&lt;br /&gt;
|00:50&lt;br /&gt;
|What we will do is type our &amp;quot;include&amp;quot; function and specify this file.&lt;br /&gt;
|-&lt;br /&gt;
|00:55&lt;br /&gt;
|I will create another file which is my main &amp;quot;mysql&amp;quot; file&lt;br /&gt;
|-&lt;br /&gt;
|01:02&lt;br /&gt;
|with a code that I will show you all.&lt;br /&gt;
|-&lt;br /&gt;
|01:03&lt;br /&gt;
|Ok so I have got my mysql dot php open.&lt;br /&gt;
|-&lt;br /&gt;
|01:07&lt;br /&gt;
|This is php codes and we need the php tags and the same will connect to php&lt;br /&gt;
|-&lt;br /&gt;
|01:13&lt;br /&gt;
|I will explain this &amp;quot;include&amp;quot; function in a minute.&lt;br /&gt;
|-&lt;br /&gt;
|01:18&lt;br /&gt;
|First, I will teach you how to connect to the database.&lt;br /&gt;
|-&lt;br /&gt;
|01:23&lt;br /&gt;
|If you don't know where you have it stored on your webserver, then I suggest you check out an application called phpmyadmin.&lt;br /&gt;
|-&lt;br /&gt;
|01:38&lt;br /&gt;
|It is a database interface php written program or in other words a script.&lt;br /&gt;
|-&lt;br /&gt;
|01:44&lt;br /&gt;
|Here we will look at the inside of my database, my service.&lt;br /&gt;
|-&lt;br /&gt;
|01:51&lt;br /&gt;
|Rather my server, My SQL server.  It gives our table information, our database information and information about my server etc etc.&lt;br /&gt;
|-&lt;br /&gt;
|02:03&lt;br /&gt;
|Although, we don't need to know about it, this is a good start to a program, if you are just starting to use a php mysql or just mysql in general.&lt;br /&gt;
|-&lt;br /&gt;
|02:10&lt;br /&gt;
|It is a good way to start interfacing with your database, instead of using the command line to do things.&lt;br /&gt;
|-&lt;br /&gt;
|02:17&lt;br /&gt;
|Using command line could be difficult for the first timers.&lt;br /&gt;
|-&lt;br /&gt;
|02:21&lt;br /&gt;
|Ok, so what we see here are, our databases.&lt;br /&gt;
|-&lt;br /&gt;
|02:25&lt;br /&gt;
|I have got one called &amp;quot;phpacademy&amp;quot; and I have got one called &amp;quot;phplogin&amp;quot; which I mentioned in another  tutorial that I have created.&lt;br /&gt;
|-&lt;br /&gt;
|02:30&lt;br /&gt;
|The others are just a standard.&lt;br /&gt;
|-&lt;br /&gt;
|02:32&lt;br /&gt;
|They are just for holding data.&lt;br /&gt;
|-&lt;br /&gt;
|02:33&lt;br /&gt;
|Don't delete them.&lt;br /&gt;
|-&lt;br /&gt;
|02:36&lt;br /&gt;
|All you need to do is create new databases. &lt;br /&gt;
|-&lt;br /&gt;
|02:39&lt;br /&gt;
|To do this, you have got a simple box here. &lt;br /&gt;
|-&lt;br /&gt;
|02:41&lt;br /&gt;
|We are just going to create databases.&lt;br /&gt;
|-&lt;br /&gt;
|02:43&lt;br /&gt;
|I will work within my php academy database for now.&lt;br /&gt;
|-&lt;br /&gt;
|02:51&lt;br /&gt;
|It is a lot easier.&lt;br /&gt;
|-&lt;br /&gt;
|02:53&lt;br /&gt;
|So its creating a database now.&lt;br /&gt;
|-&lt;br /&gt;
|02:55&lt;br /&gt;
|It is simple.&lt;br /&gt;
|-&lt;br /&gt;
|02:56&lt;br /&gt;
|You type in the name and click on &amp;quot;Create&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|02:59&lt;br /&gt;
|My php has already been created here.&lt;br /&gt;
|-&lt;br /&gt;
|03:00&lt;br /&gt;
|So I will use this one. &lt;br /&gt;
|-&lt;br /&gt;
|03:02&lt;br /&gt;
|Click on it and you can see that there are several tables inside.&lt;br /&gt;
|-&lt;br /&gt;
|03:06&lt;br /&gt;
|This is denoted by the symbol here when using phpmyadmin.&lt;br /&gt;
|-&lt;br /&gt;
|03:09&lt;br /&gt;
|This is guestbook from my guestbook tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|03:12&lt;br /&gt;
|Now I will create a new table on this database for the specifics of this tutorial and I shall call it &amp;quot;people&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|03:28&lt;br /&gt;
|The number of fields is quite important. &lt;br /&gt;
|-&lt;br /&gt;
|03:31&lt;br /&gt;
|You can't leave this blank.&lt;br /&gt;
|-&lt;br /&gt;
|03:32&lt;br /&gt;
|The number of fields on your table is for storing each column of data.&lt;br /&gt;
|-&lt;br /&gt;
|03:41&lt;br /&gt;
|For example, the first one usually when you are dealing with records, you can have an ID which is a numerical value.&lt;br /&gt;
|-&lt;br /&gt;
|03:47&lt;br /&gt;
|So it is a number that is going to increment each time.&lt;br /&gt;
|-&lt;br /&gt;
|03:50&lt;br /&gt;
|It will allow you to reference your records being stored individually by the unique number. &lt;br /&gt;
|-&lt;br /&gt;
|03:59&lt;br /&gt;
|And usually set this to the primary key. &lt;br /&gt;
|-&lt;br /&gt;
|04:01 &lt;br /&gt;
|If you are not familiar with the databases, you need to start looking out for terms like primary key.&lt;br /&gt;
|-&lt;br /&gt;
|04:08&lt;br /&gt;
|I will not be dealing with secondary keys because its quite flexible way to do this anyway with mysql database.&lt;br /&gt;
|-&lt;br /&gt;
|04:16&lt;br /&gt;
|Just read up on databases in general, if you have Microsoft access or any other database program. &lt;br /&gt;
|-&lt;br /&gt;
|04:25&lt;br /&gt;
|I suggest you to learn about groups of database.&lt;br /&gt;
|-&lt;br /&gt;
|04:29&lt;br /&gt;
|Ok, so the number of fields depends on how much data you want to store and what data you want to store. &lt;br /&gt;
|-&lt;br /&gt;
|04:36&lt;br /&gt;
|Usually when I am creating fields, I will bring out an usual blank document. &lt;br /&gt;
|-&lt;br /&gt;
|04:40&lt;br /&gt;
|And I will start by typing out the fields that I want.&lt;br /&gt;
|-&lt;br /&gt;
|04:43&lt;br /&gt;
|The first one is always going be ID.&lt;br /&gt;
|-&lt;br /&gt;
|04:45&lt;br /&gt;
|This is a self incrementing value every time I create a new record.&lt;br /&gt;
|-&lt;br /&gt;
|04:50&lt;br /&gt;
|So it will be 1 for the first record, 2,3,4 and the data will be stored after this.&lt;br /&gt;
|-&lt;br /&gt;
|04:58&lt;br /&gt;
|It is a very useful field.&lt;br /&gt;
|-&lt;br /&gt;
|05:01&lt;br /&gt;
|Since my table is called &amp;quot;people&amp;quot;, I will store some data about people.&lt;br /&gt;
|-&lt;br /&gt;
|05:07&lt;br /&gt;
|So I will first type in the firstname and then I will type in the lastname and then age and then gender.&lt;br /&gt;
|-&lt;br /&gt;
|05:16&lt;br /&gt;
|We can leave it there for now, to keep it simple.&lt;br /&gt;
|-&lt;br /&gt;
|05:20&lt;br /&gt;
|So here we can see that we have got 5 fields.&lt;br /&gt;
|-&lt;br /&gt;
|05:23&lt;br /&gt;
|I shall go back here and type in 5 and click &amp;quot;Go&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|05:28&lt;br /&gt;
|It will also be great to see a pop up here in a minute. &lt;br /&gt;
|-&lt;br /&gt;
|05:32&lt;br /&gt;
|No you won't because we haven't created our field names yet.&lt;br /&gt;
|-&lt;br /&gt;
|05:35&lt;br /&gt;
|Ok! We have a standard here.&lt;br /&gt;
|-&lt;br /&gt;
|05:37&lt;br /&gt;
|There are a lot of options for these.&lt;br /&gt;
|-&lt;br /&gt;
|05:40&lt;br /&gt;
|But, a field is a fieldname.&lt;br /&gt;
|-&lt;br /&gt;
|05:41&lt;br /&gt;
|So the first one is going to be &amp;quot;ID&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|05:43&lt;br /&gt;
|The type is the data type, that you want to store this field in.&lt;br /&gt;
|-&lt;br /&gt;
|05:47&lt;br /&gt;
|Anything that goes into it must be added here to this datatype.&lt;br /&gt;
|-&lt;br /&gt;
|05:50&lt;br /&gt;
|&amp;quot;varchar&amp;quot; which stands for variable characters is quite common.  It is a very useful one and it requires a length.&lt;br /&gt;
|-&lt;br /&gt;
|05:57&lt;br /&gt;
|We can have 25 characters long here.&lt;br /&gt;
|-&lt;br /&gt;
|06:00&lt;br /&gt;
|You could have 250 characters long.&lt;br /&gt;
|-&lt;br /&gt;
|06:02&lt;br /&gt;
|Or 100 characters long.&lt;br /&gt;
|-&lt;br /&gt;
|06:04&lt;br /&gt;
|Or 1 character long.&lt;br /&gt;
|-&lt;br /&gt;
|06:06&lt;br /&gt;
|Actually we are just storing the type and the length of the data stored.&lt;br /&gt;
|-&lt;br /&gt;
|06:14&lt;br /&gt;
|It helps in storing, for example your firstname. &lt;br /&gt;
|-&lt;br /&gt;
|06:19&lt;br /&gt;
|Lets say our fieldname here is &amp;quot;firstname&amp;quot; and I have a &amp;quot;varchar&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|06:24&lt;br /&gt;
|There is no point in typing in 500 characters because we will be using unnecessary amount of data. &lt;br /&gt;
|-&lt;br /&gt;
|06:33&lt;br /&gt;
|A typical firstname will not be more than 25 characters.&lt;br /&gt;
|-&lt;br /&gt;
|06:37&lt;br /&gt;
|Even if it is, it will not be more than 30 or 35 characters.&lt;br /&gt;
|-&lt;br /&gt;
|06:42&lt;br /&gt;
|But for now I will store my &amp;quot;firstname&amp;quot; as 20 or 25 characters, I will put 20 here. &lt;br /&gt;
|-&lt;br /&gt;
|06:48&lt;br /&gt;
|Our &amp;quot;ID&amp;quot; will be an integer because it is a number.&lt;br /&gt;
|-&lt;br /&gt;
|06:54&lt;br /&gt;
|It will be self incrementing.&lt;br /&gt;
|-&lt;br /&gt;
|06:55&lt;br /&gt;
|This will be 1,2,3,4&lt;br /&gt;
|-&lt;br /&gt;
|06:56&lt;br /&gt;
|The amount of records we use. &lt;br /&gt;
|-&lt;br /&gt;
|06:57&lt;br /&gt;
|And we have some other options here.&lt;br /&gt;
|-&lt;br /&gt;
|07:02&lt;br /&gt;
|Now this here is primary key.&lt;br /&gt;
|-&lt;br /&gt;
|07:04&lt;br /&gt;
|We are going to select it and at extra, we can see that we got &amp;quot;auto underscore increment&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|07:09&lt;br /&gt;
|This is an auto increment. &lt;br /&gt;
|-&lt;br /&gt;
|07:11&lt;br /&gt;
|It will give this particular function. &lt;br /&gt;
|-&lt;br /&gt;
|07:13&lt;br /&gt;
|Whenever you enter a new record, this will also automatically go up.&lt;br /&gt;
|-&lt;br /&gt;
|07:19&lt;br /&gt;
|So here we have &amp;quot;firstname&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|07:21&lt;br /&gt;
|We have &amp;quot;lastname&amp;quot; and again I will set this as 30.&lt;br /&gt;
|-&lt;br /&gt;
|07:26&lt;br /&gt;
|And what else do we have???&lt;br /&gt;
|-&lt;br /&gt;
|07:28&lt;br /&gt;
|We have &amp;quot;age&amp;quot; and obviously this is an integer and we have &amp;quot;gender&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|07:34&lt;br /&gt;
|Ok.&lt;br /&gt;
|-&lt;br /&gt;
|07:36&lt;br /&gt;
|Now here instead of &amp;quot;age&amp;quot;, I will say say &amp;quot;Date of birth&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|07:40&lt;br /&gt;
|So this is Date of Birth.&lt;br /&gt;
|-&lt;br /&gt;
|07:44&lt;br /&gt;
|I will set this as date. &lt;br /&gt;
|-&lt;br /&gt;
|07:46&lt;br /&gt;
|Here I am  trying to find a date datatype and I will see how this works.&lt;br /&gt;
|-&lt;br /&gt;
|07:52&lt;br /&gt;
|So our length for date doesn't have to be set here.&lt;br /&gt;
|-&lt;br /&gt;
|07:55&lt;br /&gt;
|We have a standard format for this. So we don't have to worry about that.&lt;br /&gt;
|-&lt;br /&gt;
|08:00&lt;br /&gt;
|Now I will set the &amp;quot;gender&amp;quot; as &amp;quot;varchar&amp;quot; of character 1.&lt;br /&gt;
|-&lt;br /&gt;
|08:07&lt;br /&gt;
|Now we can store &amp;quot;M&amp;quot; for male and &amp;quot;F&amp;quot; for female.&lt;br /&gt;
|-&lt;br /&gt;
|08:12&lt;br /&gt;
|Ok. If we go across here, we can see that there are a lots of options. &lt;br /&gt;
|-&lt;br /&gt;
|08:18&lt;br /&gt;
|You can comment this yourself.&lt;br /&gt;
|-&lt;br /&gt;
|08:19&lt;br /&gt;
|You can remind yourself what this field does. &lt;br /&gt;
|-&lt;br /&gt;
|08:22&lt;br /&gt;
|But usually name your fieldname appropriately so you know what data you are saving.&lt;br /&gt;
|-&lt;br /&gt;
|08:26&lt;br /&gt;
|Ok. Here I will click on &amp;quot;Save&amp;quot; and you can see that &amp;quot;people&amp;quot; has appeared here.&lt;br /&gt;
|-&lt;br /&gt;
|08:35&lt;br /&gt;
|This will ask you a query here.&lt;br /&gt;
|-&lt;br /&gt;
|08:38&lt;br /&gt;
|Now when I was talking about command line earlier, this is what you have to type to create that.&lt;br /&gt;
|-&lt;br /&gt;
|08:41&lt;br /&gt;
|However, we have used a graphic user interface to save ours.&lt;br /&gt;
|-&lt;br /&gt;
|08:45&lt;br /&gt;
|We can see down here, we have our fields, our types and our collation attributes, null data for example.&lt;br /&gt;
|-&lt;br /&gt;
|08:52&lt;br /&gt;
|The default value that is stored as.... say for example if you had a field saying &amp;quot;Has the user registered?&amp;quot; &lt;br /&gt;
|-&lt;br /&gt;
|09:02&lt;br /&gt;
|Or anything of your choice.  You could use the default here too.&lt;br /&gt;
|-&lt;br /&gt;
|09:13&lt;br /&gt;
|For example if I wanted to store everyone, I have registered here as male by default or female by default, I could type &amp;quot;M&amp;quot; or &amp;quot;F&amp;quot; here.&lt;br /&gt;
|-&lt;br /&gt;
|09:21&lt;br /&gt;
|And we have auto increment here and also some other data that we don't need to know about in this tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|09:26&lt;br /&gt;
|Ok here we have created our table and if you go in part II of this, I will show you how to insert some data and also how to retrieve this data from your database using php.&lt;br /&gt;
|-&lt;br /&gt;
|09:39&lt;br /&gt;
|Join me in part 2. This is Evan Varkey dubbing for the Spoken Tutorial Project. (Script contributed by Juanita Jayakar).&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/QCad/C2/Drawing-Methods-in-QCAD/English-timed</id>
		<title>QCad/C2/Drawing-Methods-in-QCAD/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/QCad/C2/Drawing-Methods-in-QCAD/English-timed"/>
				<updated>2013-01-02T12:19:52Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| style=&amp;quot;border-spacing:0;&amp;quot; | style=&amp;quot;border-top:0.002cm solid #000000;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;border-spacing:0;&amp;quot;&lt;br /&gt;
| style=&amp;quot;border-top:0.002cm solid #000000;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Visual Cue'''&amp;lt;/center&amp;gt;&lt;br /&gt;
| style=&amp;quot;border:0.002cm solid #000000;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Narration'''&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Show slide number 1&lt;br /&gt;
&lt;br /&gt;
(00-00:08)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.00 '''Hello and welcome back to another QCAD tutorial. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.04 '''Drawing methods in QCAD and knowing coordinate system.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 2&lt;br /&gt;
&lt;br /&gt;
(Cartesian coordinate system) (00:09-00:33)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.09 '''Qcad uses Cartesian co-ordinate system, which consists of two numbered scales, called as x-axis, y-axis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.17'''These are perpendicular to each other. These axis do divide coordinate system into 4 quadrants.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.24'''Your work in QCAD will mostly be in quadrant I&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.27 '''The point where these axis meet is called as absolute origin or the origin point.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 3 &lt;br /&gt;
&lt;br /&gt;
(Lesson Plan)(00:34-00:45).&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.34 '''For this tutorial, I am using the GNU Linux operating system Ubuntu Version 10.04 LTS &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.40 '''and QCAD Community Edition Version 2.0.5.0&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide number 3 &lt;br /&gt;
&lt;br /&gt;
(Lesson Plan)(00:46-00:55)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.46 '''In this tutorial we will see &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.48 '''Cartesian coordinate system&lt;br /&gt;
&lt;br /&gt;
'''0.51 '''How to use command line to draw objects &lt;br /&gt;
&lt;br /&gt;
'''0.53 '''and different drawing methods available in QCAD &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 4&lt;br /&gt;
&lt;br /&gt;
(Drawing methods)&lt;br /&gt;
&lt;br /&gt;
(00:56-4:08)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Switch to QCAD tool-&amp;gt;&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.56 '''Let's first see how to use command line to put in co-ordinates to draw points and draw objects of required measurements.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.06''' Using the Cartesian coordinate system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.08 '''Please have the QCAD application open in your system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.11 '''If you want to know how to install QCAD please refer to the earlier tutorial called as 'Introduction to QCAD'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.18 '''Which is available on spoken-tutorial website.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.22 '''Once the application is open from the tool bar on left choose line tool- line with two points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.28 '''Now focus on the command prompt, because we are going to use command line to put in exact coordinates.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.35 '''It is asking to 'specify first point' Let's enter 10 comma 10 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.41 '''We always add x axis value first and then y axis value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.45 '''What it is going to do is, it will add a point 10 units away from x and from y axis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.53 '''Hit enter. See the point is entered in relation to this origin or absolute 0, 0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2,00 '''Which is 10 units away from x and 10 units away from y axis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.05''' Now suppose I want to draw a horizontal line in this direction, going away from this pint. Say 10 units.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.13''' For the next point, I will add 20,10 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.18 '''X-axis value is 20 because, this point the new point will always be in relation to this absolute zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.27 '''So to meet this distance of 10 I will have to add 10 units to the earlier point's X-value.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.35''' And Y value will not change so it will be 10 here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.40 '''Now if I want to go vertical line downwards again of 10 units&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.46 '''for the next point at the command prompt I will put (showing on application so pause for 4 sec. 2:49-2:53) then say 20,0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.56 '''X-axis value won't change, Y-axis will be 20 units -ve from the earlier value. So it will be 0.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.05 '''Now again to go horizontal in 9 O'clock direction for the next point I will put (showing on application so pause for 4 sec. 3:11-3:15) 10,0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.20 '''Here Y-axis won't change and X-axis will be -10.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.26 '''In relation to the previously drawn point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.29''' Now to close my drawing I can always put 'c' and hit enter or&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.35 '''I can go back to my original point which was 10,10.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.39''' and it will close the drawing. This is how you draw using the command line input.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.45 '''You can draw any drawing by using this coordinate system by adding, subtracting absolute co-ordinates for any point or vertex between two segments.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.56 '''Like I did to draw this 10 units.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.00''' But this is going to be little complicated.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.03 '''Rather QCAD offers three easy methods to draw objects with.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 4&lt;br /&gt;
&lt;br /&gt;
(Drawing methods) &lt;br /&gt;
&lt;br /&gt;
(4:09-6:15)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Switch to QCAD tool-&amp;gt;&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''4.09 '''First is Relative co-ordinates System, &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.12 '''It uses coordinates that are relative to the last point designated, rather than a 0,0 point of the drawing area. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.19 '''@ symbol is used to enter data using this system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.26 '''Lets try drawing this previously drawn square using relative coordinate method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.30'''Let me clear the drawing area&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.35 '''Go to back line tool- Line with two points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.38 '''To specify first point at the command prompt enter 10,10- again x and y axis.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.46 '''It is going to put point at 10,10 distance. For the next point now that we are using relative system we have to put '@' symbol.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.57 '''Whenever we want to use relative system @ symbol is a must.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.01 '''After that, I want to draw horizontal line in 3 O'clock direction of 10 units.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.08 '''So X value is 10 so I put @10,0 because Y value is zero here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.16 '''Now for the vertical line going in downward direction, again for relative I use @&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.24 '''Then X value is zero but Y becomes -10 because it is going in opposite direction that is why value is -ve here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.36 '''For the next horizontal line in 9 O'clock direction, I say @&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.43 '''Now X axis is -ve, it is going in opposite direction in relation to the previously drawn point. -10,0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.53 '''Now to close the drawing I can put 'C' and enter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.57 '''Or to go back to that original point. This case I say @ 0- X-axis is zero and Y is going in +ve direction so +10.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.11 '''This is how you draw using relative coordinate method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 4&lt;br /&gt;
&lt;br /&gt;
(Drawing methods)&lt;br /&gt;
&lt;br /&gt;
(6:16-8:18)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Switch to QCAD tool-&amp;gt;&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''6.16 '''Next is Relative Polar co-ordinate system&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.20 '''It relies on distance and angle relative to the last specified point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.24 '''Always it is +ve and represents distance away from the first point.&lt;br /&gt;
&lt;br /&gt;
'''6.30 '''Let's try and draw the Previously drawn square using this relative polar coordinate system.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.36 '''In polar coordinate, right towards towards 3 O'clock is always default zero angle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.42 '''All other angles are calculated in anti-clockwise direction related to default zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.48 '''So let's go to line tool – again line with two points &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.52 '''at the command prompt specify first point as 10,10 -Enter. Point is drawn.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.00 '''Now to draw horizontal line of 10 units using relative polar coordinates. I first put @ symbol because it is relative method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.10 '''Then I say distance, I know which is 10&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.14 '''&amp;lt;nowiki&amp;gt;I use this symbol (&amp;lt;)less than symbol “&amp;lt;”for angle&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.23 '''&amp;lt;nowiki&amp;gt;I know angle is in 3 O'clock direction, which is zero. (@10&amp;lt;0)&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.28 '''so my horizontal line of 10 units is drawn.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.30 '''&amp;lt;nowiki&amp;gt;For the vertical line in downward direction I again put @10&amp;lt;270&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.37''' and 270 as angle this time because anti-clockwise downward is 270&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.50 '''for the next point horizontal line in 9 O'clock direction&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.54 '''&amp;lt;nowiki&amp;gt;I say @10&amp;lt;180, angle will be 180, as it is exactly opposite to the default zero position.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.05 '''&amp;lt;nowiki&amp;gt;Lastly I can always put 'c' to close or else enter the point as @10&amp;lt;90, because it is going in upward direction.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.16 '''This completes our drawing in Polar coordinate method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 4&lt;br /&gt;
&lt;br /&gt;
(Drawing methods)&lt;br /&gt;
&lt;br /&gt;
(8:19-11:09)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Switch to QCAD tool-&amp;gt;&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''8.19 '''Third is the Direct distance method&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.22 '''Which can be used to draw lines by specifying first point in relation to already drawn object using snapping tools. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.30 '''By placing a cursor at that point and entering a distance value. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.35 '''Let's say in this drawing, if I want to put a horizontal line going in 3 O'clock direction exactly from this point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.43 '''I can do so by using this direct method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.50 '''I choose line- line with two points&lt;br /&gt;
&lt;br /&gt;
Now I know exactly at what point I want line ahead&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.57 '''so from snapping options on the left tool bar I choose 'snap to endpoint' and then go on that point and left click to select the first point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.09 '''Now in relation to this I want to draw horizontal line of 20 units.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.15 '''So I use command line to specify my next point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.20 '''I can use relative polar coordinate system here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.24 '''&amp;lt;nowiki&amp;gt;Since it is relative I say @ now distance is 20 and in 3O'clock direction, which is default zero angle so I say @20&amp;lt;0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.36 '''and Enter. The line is drawn.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.39 '''Now say I want vertical line of say 7 units going in 90 degrees direction.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.46 '''I can use now relative coordinate method here.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.52 '''and say @ (I know 7 is Y direction and X is zero)so 0,7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.01 '''and I can use relative coordinate method to draw this vertical line.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.07'''Again if I want horizontal line going in 9 O'clock direction say 5 units away.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.12 '''I can again use relative coordinate method.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.12''' At the command prompt I say @ -5 now because X value will be -ve comma 0, Y is zero.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.18 '''Now I can close down this line, because I know the distance is 7&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.33 '''I can draw vertical line going towards 6 O'clock directions&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.39 '''Once I know all the different methods I can draw objects with. I can use combination of any to draw objects.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.46 '''Now to draw that vertical line, I can use relative polar coordinate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.51 '''&amp;lt;nowiki&amp;gt;So I say @I know distance is 7, I use '&amp;lt;' symbol, since it is 6 O'clock direction it is going to be 270 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.00'''This completes our drawing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.06 '''This is how you use different methods in QCAD.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to Slide 5&lt;br /&gt;
&lt;br /&gt;
(Assignment)&lt;br /&gt;
&lt;br /&gt;
(11:10-11:27)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''11.10 '''Now that you are familiar with drawing methods and the coordinates system in QCAD.&lt;br /&gt;
&lt;br /&gt;
'''11.15 '''Lets come to the to the ASSIGNMENT. &lt;br /&gt;
&lt;br /&gt;
[[Image:]]&lt;br /&gt;
&lt;br /&gt;
'''11.17 '''i would like you to draw diagram as shown in the figure. &lt;br /&gt;
&lt;br /&gt;
'''11.20 '''You can either use relative coordinate, relative polar, direct method or combination of any method to draw this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to Slide 6&lt;br /&gt;
&lt;br /&gt;
(Acknowledgement)&lt;br /&gt;
&lt;br /&gt;
11:28-11:45)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''11.29 '''I would like to acknowledge the spoken tutorial project which is part of the talk to a teacher project.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.33 '''It is supported by the National Mission on Education through ICT, MHRD government of India.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.40 '''For more information on this please visit following website. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to Slide 7&lt;br /&gt;
&lt;br /&gt;
(11:46-11:52)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''11.46 '''Thank you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.47 '''Hope you are enjoying exploring QCAD&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.50'''This is Leena signing off. &lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/QCad/C2/Introduction-to-QCAD/English-timed</id>
		<title>QCad/C2/Introduction-to-QCAD/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/QCad/C2/Introduction-to-QCAD/English-timed"/>
				<updated>2013-01-02T12:18:34Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| style=&amp;quot;border-spacing:0;&amp;quot; | style=&amp;quot;border-top:0.002cm solid #000000;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| style=&amp;quot;border-spacing:0;&amp;quot;&lt;br /&gt;
| style=&amp;quot;border-top:0.002cm solid #000000;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Visual Cue'''&amp;lt;/center&amp;gt;&lt;br /&gt;
| style=&amp;quot;border:0.002cm solid #000000;padding:0.097cm;&amp;quot;| &amp;lt;center&amp;gt;'''Narration'''&amp;lt;/center&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Show slide number 1&lt;br /&gt;
&lt;br /&gt;
(0:0-0:10)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.00 '''Hello and welcome to the tutorial Introduction to QCAD -2D drafting tool. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.04 '''In this tutorial I will introduce you to the basics of QCAD tool and its interface.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 2&lt;br /&gt;
&lt;br /&gt;
(What is QCAD?) &lt;br /&gt;
&lt;br /&gt;
(0:11-0:29)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.11 '''Let's look at what is QCAD? &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.12 '''It is an application for computer aided drafting(CAD) in two dimensions. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.16''' Using QCAD you can create technical drawings such as plans for buildings, interiors, mechanical parts or schemas and diagrams. &lt;br /&gt;
&lt;br /&gt;
'''0.24 '''Community edition of QCAD is available freely for download at: http://www.qcad.org/&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to slide number 3 &lt;br /&gt;
&lt;br /&gt;
(Lesson Plan) &lt;br /&gt;
&lt;br /&gt;
(0:30-1.09)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''0.31'''For this tutorial, I am using GNU Linux operating system Ubuntu Version 10.04 LTS &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.38''' and QCAD Community Edition Version 2.0.5.0&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.41 '''If you do not have it installed on your system, &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.47''' you can do so by going to System-&amp;gt;Administration-&amp;gt;Synaptic Package Manager and &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.55''' at the search box look for QCAD. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''0.58''' And install these applications&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.01'''For more information on how to install software using synaptic,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.05''' please refer to spoken tutorial available on this website: www.spoken-tutorial.org&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to Desktop to Open QCAD&lt;br /&gt;
&lt;br /&gt;
(1:10 -1.27)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''1.10 '''Once installed to start QCAD in Ubuntu 10.04 go to Applications-&amp;gt;Accessories-&amp;gt;terminal &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.17''' and at the prompt type “qcad” and hit 'Enter' &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.21''' This will launch the application in 10.04 version. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.24''' For other Ubuntu versions it is available under Applications menu.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Slide 4&lt;br /&gt;
&lt;br /&gt;
(Lesson Plan)&lt;br /&gt;
&lt;br /&gt;
(1:28-1:36)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''1.28''' In this tutorial we will see &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.33 '''Menu items and tool bar&lt;br /&gt;
&lt;br /&gt;
drawing objects &lt;br /&gt;
&lt;br /&gt;
snapping options&lt;br /&gt;
&lt;br /&gt;
and using layers&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to QCAD Applicationto explain the window&lt;br /&gt;
&lt;br /&gt;
(1.37-3:05) &lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''1.37''' A typical QCAD window looks like this.&lt;br /&gt;
&lt;br /&gt;
'''1.40''' It has a standard menu bar on top. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.42''' Options like Draw, Dimension, Modify and Snap are QCAD specific. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.47''' On the left side is the tool bar, which is used to draw objects. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.53 '''At the very bottom is the status bar which displays various information about the current drawing. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''1.59''' Notice as my mouse is moving in the drawing area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.02''' Coordinate widget on the extreme left side is displaying absolute and relative position of my mouse cursor.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.10''' Just above the status bar is the command line for QCad. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.13''' Which is used to put in exact co-ordinates to draw objects.&lt;br /&gt;
&lt;br /&gt;
'''2.18'''At the right side is the layer list and the block list. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.22'''These list the layers and blocks related information for the current drawing. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.26''' We will look at these in detail in subsequent tutorials.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.30''' Right in the middle is the drawing area. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.33''' Black in colour with dots.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2.35 Dots signify the grid, at any time you can choose not to view grid by going on to top option and click on this 'grid' icon to not to show the grid.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.47''' Click it back again to make it visible.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''2.50''' Similarly all other windows as status bar, command line, block and lists can be enabled / disabled going to top menu View.-&amp;gt;Views&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.00''' and select check box in front of the window of your choice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| On QCAD Window View Drawing Objects&lt;br /&gt;
&lt;br /&gt;
(3:06-6:13)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''3.06''' QCAD uses Cartesian and polar coordinates system to draw objects. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.11''' To draw objects we use tool bar from left or this can also be accessed from top menu → Draw option.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.19''' Let's start by drawing a line. From the tool bar click on the line icon.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.23''' There are numerous options to choose from&lt;br /&gt;
&lt;br /&gt;
'''3.26''' Let's click on line with two points. Notice the command prompt is asking to specify first point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.29 '''Move your mouse cursor on the drawing area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.36''' There are two things happening now &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.37 '''1. mouse cursor has changed into white cross hair.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.43''' 2.There is blue circle appearing right below the mouse cursor&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.46''' It is basically hopping from grid to grid as I move my mouse, waiting for me to select.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.51''' I can click left mouse button to click for the start of the line&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''3.58''' and click again to for the line to end. Line is drawn. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.04''' Notice if I keep clicking further it will start drawing line, as QCAD is still in line command. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.10''' For this I need to come out of that command&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.13''' To come out of any command you press either 'Enter' or 'Esc' button on keyboard twice or double click right mouse button. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.21''' You will be out of any command&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.23 '''Similarly you can draw Parallel lines, horizontal lines, vertical lines, parallel lines with distance. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.31 '''Let's see this option. When I choose this option I need to specify distance between the lines and number of lines. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.40 '''let's say 10 here and no. of lines I want 3. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.47 '''You will move mouse cursor closer to entity in relation to which you would want parallel lines to be drawn. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''4.54''' Once satisfied I can confirm selection by clicking on left mouse button, and lines will be drawn on the board.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.03''' Now let us see the arc tool. From the tool bar choose arc.&lt;br /&gt;
&lt;br /&gt;
'''5.07 '''I am choosing arc with centre point and angles. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.13''' From snapping option let's choose 'snap to grid'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.17''' Notice command prompt is asking to specify centre, left click to specify centre. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.22 '''Now it is asking to specify radius, I can enter say 30. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.27 '''Now specify start angle and click again for end angle and arc is drawn. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.32 '''Double click right mouse button to come out of that command.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.35''' Lets try and draw circle. Go to the circle icon from tool box, click on it. I am using circle with centre and radius. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.44 '''Again from the snapping option choose 'snap to grid'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.48'''Command line is asking to specify circle's centre.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.51''' Go on the grid and left click to specify centre. Circle is drawn.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''5.56 '''It is drawn with previously specified radius. If I want to change I can change and draw new circle with different radius.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.06''' Unless you come out of that command, it will keep on drawing circles.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.10 '''So double click right mouse button and you are out of that.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Use zoom option, drawing preferences and saving QCAD file.&lt;br /&gt;
&lt;br /&gt;
(6:13-9:21)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''6.13''' Now that my drawing has become busier I can use zoom from top menu → view-&amp;gt; Zoom in to zoom in on the more details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.24'''and view-&amp;gt; Zoom out to see the wider extent. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.26''' Zoom is very essential command because it is very useful when you draw details.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.32'''Similar effects can be achieved by rolling a middle mouse button to zoom in and out &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.37''' Or I can also use View-&amp;gt;(third option)Auto zoom to fit the drawing in the given area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.44''' Let's try drawing a new file, Let me clear this area.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.50''' For this I click at one corner select and then from top menu-&amp;gt;modify-&amp;gt;Delete selected. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''6.58''' Every drawing QCAD starts at absolute 0,0 position it is marked by red cross hair on the drawing area. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.05 '''Every other point is drawn in relation with this point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.11''' Before starting any drawing it is important to set drawing preferences' for QCAD to know which units you are using, what grid size you would want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.18 '''For this you go to Edit- and there are Application Preferences and Current drawing preferences.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''Application preferences'''&lt;br /&gt;
&lt;br /&gt;
'''7.25''' Are the ones which apply to entire QCAD application, rather than just a single drawing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.32''' You can change background, grid colour, meta colour, language options and set the default Units that you want.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.42''' Lets say 'meter' here and click 'OK'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.46''' Now let's go to Edit -&amp;gt;set '''Current Drawing preferences''': These apply only to current drawing and once you close the drawing these needs to be set again.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''7.57 '''Paper applies only when we want to print a drawing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.00''' Units: You can set units for that particular drawing, let's say 'Inch' here. Decimal, precision can be 0.00.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.10''' Grid: You can either choose to show grid or not show grid. You can give grid size as .5x.5 specific size that you want. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.20''' Dimensions: Are useful when you want to start dimensioning on the drawing. Extension line, text height all these points matters when you want to show text.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.34''' If you think text height or the line or arrow is too small, you can always revisit this area later. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.42''' I am setting some things now, after you are done click 'OK'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.51''' It is better to save the drawing&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''8.55''' We go to File-&amp;gt;save as and select the directory where you would want to save it.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.09''' I want to save it as qcad-dwg. Notice it is saving it as dxf format&lt;br /&gt;
&lt;br /&gt;
Document Exchange Format, which is QCAD native.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.18 '''Click on save, it saves the drawing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| QCAD Window&lt;br /&gt;
&lt;br /&gt;
Using the Application and snap tool&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
(9:22-11:04)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''9.22''' let us start with our drawing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.24'''We will draw rectangle and then cut it in half by drawing a line in the middle and draw circle exactly in the centre.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.30 Draw rectangle''':Go to tool bar-Line option. select rectangle. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.37 '''From the snapping options, choose 'snap to grid'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.40 '''Move cursor over the drawing area and left click for the first corner of rectangle and click away for second corner .&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.54''' Rectangle is drawn.Double click right mouse button to come out of that command. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''9.59 draw line going through''' middle:Now we want to draw line exactly in the middle, cutting it in two halves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.03'''This is where snapping options will be useful.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.06 '''Let's go click on line- Line with two points.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.10 '''Now from grid options, since I want it exactly at middle. I choose 'snap to middle point'. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.17 '''And I go on the top line, notice it is snapping exactly to the middle point of the top line, click there.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.25''' Go on the bottom line, click again. The line is drawn cutting the rectangle in two halves.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.30 draw circle in the centre of rectangle''': Now let's draw circle in the centre of the rectangle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.34''' Click on circles icon and I am choosing centre and radius. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.37''' Go over here. If you want circle to occupy entire width.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.40''' I know my grid is .5x.5 and there are 6 divisions. So that means my rectangle is 30x40. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.48''' So I put radius 15 to cover entire width, and notice I need to click on the snap to 'centre point'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''10.54''' And left click to confirm. Circle is drawn exactly in the centre of the rectangle.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| QCAD Using Layers and adding dimensions&lt;br /&gt;
&lt;br /&gt;
(11:05-12:11)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''11.04''' Now that our drawing is ready so let's add dimensions. We always add dimensions to new layer so that we can keep it separate.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.14 '''Click on '+' sign to add new layer. Go to 'dimensions'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.19''' Give it a different colour, so that we can identify it separate from rest of the drawing.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.24''' You can use type 'dash' then you go to top menu 'Dimensions'&lt;br /&gt;
&lt;br /&gt;
Horizontal first. From the snapping option click on 'end point'&lt;br /&gt;
&lt;br /&gt;
Click on first point of the line, then second point.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.37 '''Now to place dimensions away from the line, from snapping option I can choose 'snap to grid' or free positioning and place it away. Left click once.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.48 '''Again to place vertical go to dimensions-&amp;gt;vertical, from end point&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.54''' Place it again away by using 'free positioning'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''11.58 '''This way if I have it on different layer I can always, when drawing gets busier click on Eye icon to not to show that layer and see the drawing clearly.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.07''' When you want it back, click back on eye icon to make it visible.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| QCAD changing drawing properties&lt;br /&gt;
&lt;br /&gt;
(12:11-12:35)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''12.11 '''Now if I want to change attributes of any object.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.I4''' click on that object and go to Modify-&amp;gt;attributes&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.18 '''Now once the selection is made, click on the arrow.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.21 '''Let's say I want to change, colour to 'Red'&lt;br /&gt;
&lt;br /&gt;
'''12.24''' Width: let's increase it&lt;br /&gt;
&lt;br /&gt;
and the type: make it 'Dash and dot', click 'ok'&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.30 '''The attributes are changed. Let's save the drawing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to Slide 4&lt;br /&gt;
&lt;br /&gt;
(Assignment)&lt;br /&gt;
&lt;br /&gt;
12:36-12:55)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''12.36''' Now that you are familiar with the QCAD basic tool bar and drawing objects. &lt;br /&gt;
&lt;br /&gt;
[[Image:]]'''12.40 '''I would like you to draw a rectangle as shown in the figure. of size 20x30.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.45''' with centre line of type dash and dot and red in colour. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.50''' Draw two parallel lines are 5 units apart.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''12.54 '''Add dimensions on a new layer.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to Slide 5&lt;br /&gt;
&lt;br /&gt;
(Acknowledgement)&lt;br /&gt;
&lt;br /&gt;
12:56-13:09)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''12.56 '''I would like to acknowledge the spoken tutorial project which is part of the talk to a teacher project. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''13.01 '''It is supported by the National Mission on Education through ICT, MHRD government of India.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''13.06'''And you can see more information about this at this website. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:none;padding:0.097cm;&amp;quot;| Switch to Slide 6&lt;br /&gt;
&lt;br /&gt;
(13:10-13:16)&lt;br /&gt;
| style=&amp;quot;border-top:none;border-bottom:0.002cm solid #000000;border-left:0.002cm solid #000000;border-right:0.002cm solid #000000;padding:0.097cm;&amp;quot;| '''13.11 '''Thank you.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''13.12 '''I hope you enjoyed the tutorial and enjoy exploring QCAD.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
'''13.16 '''This is Leena signing off. &lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C4/Testing-and-debugging/English-timed</id>
		<title>Python/C4/Testing-and-debugging/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C4/Testing-and-debugging/English-timed"/>
				<updated>2013-01-02T12:17:02Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello Friends and Welcome to the tutorial on 'Testing and Debugging'.  |- |  0:05 | At the end of the tutorial, you will be able to…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello Friends and Welcome to the tutorial on 'Testing and Debugging'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:05&lt;br /&gt;
| At the end of the tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Understand what is software testing.&lt;br /&gt;
# Test simple functions for their functionality.&lt;br /&gt;
# Automate tests.&lt;br /&gt;
# Understand the need for coding style&lt;br /&gt;
# Learn some of the standards followed by the Python Community.&lt;br /&gt;
# Handle Errors and Exceptions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:21&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with functions&amp;quot; and &amp;quot;Advanced Features of the Functions&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:28&lt;br /&gt;
| Now, what is software testing? &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:30&lt;br /&gt;
| Software testing is an activity aimed at evaluating a program and determining that it meets its required results.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:37&lt;br /&gt;
| Lets first write an example  simple function to calculate gcd of two numbers. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:43&lt;br /&gt;
| Open an editor and type the following code shown on the slide and save it as gcd.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:50&lt;br /&gt;
| Save the file as gcd.py in  slash home slash fossee slash  path.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:56&lt;br /&gt;
| Now we need to evaluate this function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:58&lt;br /&gt;
| That is, we have to check whether this function successfully gives us the gcd of two whole numbers. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:04&lt;br /&gt;
| Thus we need a set of inputs and the exact outputs that are expected for those input test cases.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:10&lt;br /&gt;
| Let our test case be 48 and 64 as ''a'' and ''b'' respectively. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:15&lt;br /&gt;
| For this test case we know that the GCD is 16. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:19&lt;br /&gt;
| So that is the expected output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:23&lt;br /&gt;
| Let us include code for testing in our file gcd.py and add the remaining lines of code to the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
|That is f  underscore   underscore name underscore   underscore  == in quotes underscore   underscore main underscore   underscore  colon&lt;br /&gt;
result = gcd within bracket 48 comma  64 if result exclamation= 16 colon&lt;br /&gt;
print  within double quotes Test failed&lt;br /&gt;
print  within double quotes Test Passed. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:02&lt;br /&gt;
| Let us now run the script and test our code &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:06&lt;br /&gt;
| We run the code by providing the entire path where the file is located.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:10&lt;br /&gt;
|That is in the terminal we can type python gcd.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:17&lt;br /&gt;
| We get the output as 'test passed' which means our code is correct. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:20&lt;br /&gt;
| Note that we have introduced a new semantic which uses two new magic names in Python '' underscore   underscore name underscore   underscore '' and '' underscore   underscore main underscore   underscore ''. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:31&lt;br /&gt;
| This is a very common idiom used in Python. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:35&lt;br /&gt;
| Every Python code in a file can be run in two ways: Either as an independent stand-alone script or as a Python module which can be imported by other Python scripts or modules.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:48&lt;br /&gt;
| When the idiom&lt;br /&gt;
if  underscore   underscore name underscore   underscore  == ' underscore   underscore main underscore   underscore '&lt;br /&gt;
is used, the code within this if block is executed first when we run the Python file as a stand-alone script. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:04&lt;br /&gt;
| In other words, when we run this python file as a stand-alone script, the control of the program first starts from the code that is within this if block after which the control is transferred to other parts of the program or to other modules from here. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:21&lt;br /&gt;
| This comes as an extremely handy feature especially when we want to test our modules individually.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:27&lt;br /&gt;
| But there can be a number of places where the gcd function might break. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:33&lt;br /&gt;
| Would we have to write a separate test case for all of them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:38&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:43&lt;br /&gt;
| Write code for gcd and write tests for it&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:48&lt;br /&gt;
| Well thats where automating tests come in. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:52&lt;br /&gt;
| We can run many tests to check where our code can break. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:57&lt;br /&gt;
| Lets see this with an example. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:59&lt;br /&gt;
| First lets try and automate tests on the gcd function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:05&lt;br /&gt;
| For this we will write a file with test cases and call the function for all of them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:13&lt;br /&gt;
| The file structure is shown in form a table here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:19&lt;br /&gt;
| The structure of the file will be the two parameters and the output result separated by space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:28&lt;br /&gt;
| We have separated the elements by a space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:32&lt;br /&gt;
| We add this code piece to automate the test.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:41&lt;br /&gt;
|So let us now test this code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:46&lt;br /&gt;
| Open the file gcd.py which we have created before and add this piece of code appropriately.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:00&lt;br /&gt;
| Now, we run it as, python gcd.py.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:12&lt;br /&gt;
| We see that our code has passed the test.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:15&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:21&lt;br /&gt;
| For the same inputs as gcd write automated tests for LCM.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:26&lt;br /&gt;
| We shall make use of the same automated test code which we had used for GCD with minor changes. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:32&lt;br /&gt;
| Use the data from the file lcmtestcases.txt . &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:36&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:46&lt;br /&gt;
| This is the complete solution for your problem. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:49&lt;br /&gt;
| You can test this code by running it on your terminal as we had done for gcd.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:56&lt;br /&gt;
| Thus, for any program there can be innumerable test cases. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:01&lt;br /&gt;
| Hence practically, it is not possible to test cases. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:04&lt;br /&gt;
| However there are many ideas to reduce the set of test cases by testing those cases that are more likely to show errors.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:10&lt;br /&gt;
| Moving from testing lets talk a bit about coding style now.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:15&lt;br /&gt;
| Apart from being able to perform the required task, a property of a good program is its readability. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:22&lt;br /&gt;
| Code is read more often than it is written. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:25&lt;br /&gt;
| This is because, that way, other people can learn from it and extend and improve it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:30&lt;br /&gt;
| There are certain pointers for readable code that I am going to discuss.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:34&lt;br /&gt;
| First, Naming variables.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:39&lt;br /&gt;
| We choose a name so that it becomes easier to understand it's usage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:44&lt;br /&gt;
|  Lets look at this with an example&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:47&lt;br /&gt;
| amount = 12.68 denom = 0.05 nCoins = round amount comma slash denom rAmount = nCoins star denom&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:01&lt;br /&gt;
| As we can see in this example it is very easy to make what the code is doing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:07&lt;br /&gt;
| One can almost read it as English sentences. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:10&lt;br /&gt;
| Amount is 12.68 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:12&lt;br /&gt;
| Denomination is 0.05&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:16&lt;br /&gt;
| Number of coins is round of amount by denominations.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:20&lt;br /&gt;
| Proper naming helps so much in understanding the code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:26&lt;br /&gt;
| Also one should keep in mind the following things while writing a code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:30&lt;br /&gt;
| 1. Four Space Indentation&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:33&lt;br /&gt;
| 2. Limit to 79 characters a line, but readability should come first.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:38&lt;br /&gt;
| 3. Functions and methods should be separated with two blank lines.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:41&lt;br /&gt;
| 4. No inline comments, comments should be above the line they comment.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:50&lt;br /&gt;
| 5. Use Docstring to explain units of code performing specific task like functions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:56&lt;br /&gt;
| 6. We should always have whitespace around operators and other punctuation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:00&lt;br /&gt;
| Pause the video here,and try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:05&lt;br /&gt;
| '''Give meaningful names to the variables in the following code'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:08&lt;br /&gt;
| c=a slash b&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:12&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:15&lt;br /&gt;
| As you saw, this will help enormously towards making our program more readable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:24&lt;br /&gt;
| Now move on the handling errors and exceptions. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:28&lt;br /&gt;
| Lets try out the following piece of code&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:30&lt;br /&gt;
|So type ipython&lt;br /&gt;
while True print in quotes Hello world&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:46&lt;br /&gt;
| So what happens when we do this on the interpreter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:49&lt;br /&gt;
| The interpreter says that this is a syntax error. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:52&lt;br /&gt;
| Syntax error are caused when we do not follow the rules of the programming language.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:58&lt;br /&gt;
| However lets try an expression like&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:02&lt;br /&gt;
|Typing 1 slash 0&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:06&lt;br /&gt;
| Although this expression follows the programming language rules, however it is not possible to express the solution of this expression.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:13&lt;br /&gt;
|  Thus python throws an exception called &amp;lt;tt&amp;gt;ZeroDivisionError&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:17&lt;br /&gt;
|  Exception is special kind of failure reported by the programming language.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:21&lt;br /&gt;
| Lets see why and how we can use Exception in our programs.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:26&lt;br /&gt;
|So type ipython&lt;br /&gt;
a = raw underscore input within bracket  within double quotes Enter a number colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:55&lt;br /&gt;
|Then type a non-numeric input&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:01&lt;br /&gt;
|Then type num = int a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:10&lt;br /&gt;
| You will notice that when you run this program and give and non-numeric input it throws a 'ValueError' Exception.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:21&lt;br /&gt;
| So now we can 'catch' this exception and write code to handle it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:25&lt;br /&gt;
| For this we have try and except clause in python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:29&lt;br /&gt;
| Lets change our previous code slightly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:33&lt;br /&gt;
|So type a = raw underscore input then&lt;br /&gt;
Enter a decimal number&lt;br /&gt;
&lt;br /&gt;
try colon&lt;br /&gt;
   num = int a&lt;br /&gt;
 except &lt;br /&gt;
  print within double quotes Wrong input ...&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:13&lt;br /&gt;
| In this piece of code, python tries to run the code inside the &amp;lt;tt&amp;gt;try&amp;lt;/tt&amp;gt; block but when if it fails it executes the code block in &amp;lt;tt&amp;gt;except&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:23&lt;br /&gt;
| In previous example we encountered a problem with running our conversion to integer code. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:31&lt;br /&gt;
| We found out what caused the error and then deviced a solution for it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:36&lt;br /&gt;
| This whole process is called debugging.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:38&lt;br /&gt;
| One can understand the debugging process using the figure.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:42&lt;br /&gt;
| In debugging process, we form a hypothesis of what causes the error. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:47&lt;br /&gt;
| Test if it is correct by changing the code. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:50&lt;br /&gt;
| And refine the hypothesis on the basis of our result.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:54&lt;br /&gt;
| Lets see another example of debugging. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:57&lt;br /&gt;
| Create a file mymodule.py and add the following code&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:02&lt;br /&gt;
|So type and create the file&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:07&lt;br /&gt;
|def test() colon&lt;br /&gt;
 total=1+1&lt;br /&gt;
 print spam&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:16&lt;br /&gt;
| Lets now try and run this code on the ipython interpreter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:19&lt;br /&gt;
|So we have to import the file, type import mymodule&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:27&lt;br /&gt;
|Then type mymodule.test()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:36&lt;br /&gt;
| Interpreter gives us an error because spam is not defined.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:40&lt;br /&gt;
| lets now do modula debug on ipython interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:45&lt;br /&gt;
|modula debug and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:48&lt;br /&gt;
| The prompt on the shell has changed to ipdb. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:55&lt;br /&gt;
| This is debugger here you can access variables in that code block for example 'total'unlike the normal interpreter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:06&lt;br /&gt;
| So you can type,total and check.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:11&lt;br /&gt;
| We get the correct output. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:13&lt;br /&gt;
| To exit from the ipdb prompt, press q&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:18&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:21&lt;br /&gt;
| In this tutorial,we have learnt to, 1. Create simple tests for a function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:24&lt;br /&gt;
| 2. Automate tests using many predefined test cases.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:27&lt;br /&gt;
| 3. Use the python coding standards.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:30&lt;br /&gt;
| 4. Differentiate between syntax error and exception.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:32&lt;br /&gt;
| 5. Handle exception using &amp;lt;tt&amp;gt;try&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;except&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:35&lt;br /&gt;
| 6. Use &amp;lt;tt&amp;gt;percentage debug&amp;lt;/tt&amp;gt; for debugging on ipython.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:40&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:43&lt;br /&gt;
| 1. What is proper indentation for python code according to style guidelines?&lt;br /&gt;
** two space identation&lt;br /&gt;
** three space identation&lt;br /&gt;
** four Space Indentation&lt;br /&gt;
** no Indentation&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:53&lt;br /&gt;
| 2. '''How do you start the debugger on ipython?'''&lt;br /&gt;
** &lt;br /&gt;
*** debug&lt;br /&gt;
*** Modula debug&lt;br /&gt;
*** Modula debugger&lt;br /&gt;
*** start debugger&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:01&lt;br /&gt;
| 1. What is the idiom used for running python scripts in a standalone manner?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:08&lt;br /&gt;
| So now we look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:11&lt;br /&gt;
| 1.Four Space Indentation is required for writing a python code according to style guidelines.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:19&lt;br /&gt;
| 2. We start the debugger on ipython by saying, modula debug&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:25&lt;br /&gt;
| 1. &amp;lt;tt&amp;gt;if  underscore  underscore name underscore  underscore  == in single quotes underscore  underscore main underscore  underscore  colon&amp;lt;/tt&amp;gt; is the idiom used for running python scripts in a standalone manner.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  14:40&lt;br /&gt;
| So we hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:46&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C4/Writing-python-scripts/English-timed</id>
		<title>Python/C4/Writing-python-scripts/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C4/Writing-python-scripts/English-timed"/>
				<updated>2013-01-02T12:16:20Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and welcome to the tutorial on &amp;quot;Writing Python scripts&amp;quot;.  |- | 0:05 | At the end of this tutorial, you will be able t…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and welcome to the tutorial on &amp;quot;Writing Python scripts&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Understand what is importing.&lt;br /&gt;
# Write your own Python modules.&lt;br /&gt;
# Understand the &amp;lt;tt&amp;gt; __name__ == in double quotes  __main__  underscore &amp;lt;/tt&amp;gt; idiom&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:19&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Using Python modules&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:25&lt;br /&gt;
| Often we will have to reuse the code that we have written. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:29&lt;br /&gt;
| We do that by writing functions. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:31&lt;br /&gt;
| Functions are bundled into packages and are imported as and when required in other scripts.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:37&lt;br /&gt;
| Let us first write a function that computes the gcd of two numbers and save it in a script. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:44&lt;br /&gt;
| Open an editor and type the code. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:47&lt;br /&gt;
| Please take care of the indentation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:51&lt;br /&gt;
|So type in terminal gcd underscore script.py then type def gcd within bracket  a comma  b colon&lt;br /&gt;
&lt;br /&gt;
 while b colon&lt;br /&gt;
 a comma  b = b comma  a percentage b&lt;br /&gt;
&lt;br /&gt;
    return a&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:49&lt;br /&gt;
| We shall write a test function in the script that tests the gcd function every time the script is run.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:56&lt;br /&gt;
|So type&lt;br /&gt;
if gcd within bracket 40 comma  12 == 4 colon&lt;br /&gt;
    print  within double quotes Everything OK&lt;br /&gt;
else colon&lt;br /&gt;
    print  within double quotes The GCD function is wrong&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:53&lt;br /&gt;
| Let us save the file as script.py in &amp;lt;tt&amp;gt; slash home slash fossee slash gcd script.py&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:05&lt;br /&gt;
| We shall run the script by typing in the terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:11&lt;br /&gt;
|python  slash home slash fossee slash gcd underscore script.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:25&lt;br /&gt;
| We can see that the script is executed and everything is fine.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:29&lt;br /&gt;
| What if we want to use the gcd function in some of our other scripts. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:35&lt;br /&gt;
| This is also possible since every python file can be used as a module.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:39&lt;br /&gt;
| But first, we shall understand what happens when you import a module.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:43&lt;br /&gt;
|So type ipython in terminal. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:52&lt;br /&gt;
| Open IPython and type import sys (hit enter)&lt;br /&gt;
                        sys.path&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:15&lt;br /&gt;
| This is a list of locations where python searches for a module when it encounters an import statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:20&lt;br /&gt;
| Hence, when we just did &amp;lt;tt&amp;gt;import sys&amp;lt;/tt&amp;gt;, python searches for a file named sys.py or a folder named sys in all these locations one by one, until it finds one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:34&lt;br /&gt;
| We can place our script in any one of these locations and can import it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:38&lt;br /&gt;
| The first item in the list is an empty string which means the current working directory is also searched.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:45&lt;br /&gt;
| Alternatively, we can also import the module if we are working in same directory where the script exists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:53&lt;br /&gt;
| Since we are in  slash home slash fossee, we can simply do&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:59&lt;br /&gt;
|By typing on the terminal import gcd underscore script.py and hit enter.&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
| 5:12&lt;br /&gt;
| We can see that the gcd underscore script is imported. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:18&lt;br /&gt;
| But the test code that we added at the end of the file is also executed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:23&lt;br /&gt;
| But we want the test code to be executed only when the file is run as a python script or not when it is imported.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:30&lt;br /&gt;
| This is possible by using &amp;lt;tt&amp;gt; underscore  underscore name underscore  underscore &amp;lt;/tt&amp;gt; variable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:34&lt;br /&gt;
| First, we shall look at how to use the idiom and then understand how it works.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:41&lt;br /&gt;
| Go to the file and add this line as the beginning of the code and indent the code accordingly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:47&lt;br /&gt;
|So type if  underscore   underscore name underscore   underscore  ==  within double quotes  underscore   underscore main underscore   underscore  colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:30&lt;br /&gt;
| Let us first run the code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:33&lt;br /&gt;
|So type in terminal python gcd underscore script.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:45&lt;br /&gt;
|We can see that&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:48&lt;br /&gt;
|There is an error coming up, its showing indentation error.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:57&lt;br /&gt;
|So we have to edit the file and make indentation correct.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:20&lt;br /&gt;
| We can see that the test runs successfully.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:24&lt;br /&gt;
| Now we shall import the file gcd underscore script&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:29&lt;br /&gt;
|So type import gcd underscore script&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:39&lt;br /&gt;
| We see that now the test code is not executed.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt; underscore   underscore name underscore   underscore &amp;lt;/tt&amp;gt; variable is local to every module and it is equal to &amp;lt;tt&amp;gt; underscore   underscore main underscore   underscore &amp;lt;/tt&amp;gt; only when the file is run as a script.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:54&lt;br /&gt;
| Hence, all the code that goes in to the if block, &amp;lt;tt&amp;gt;if name ==  within double quotes  main colon&amp;lt;/tt&amp;gt; is executed only when the file is run as a python script.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:08&lt;br /&gt;
| This brings us to the end of the tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:11&lt;br /&gt;
| In this tutorial, we have learnt to, 1. Know what happens when we import a module.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:16&lt;br /&gt;
| 2.Use a script as a module.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:18&lt;br /&gt;
| 3. Write test functions using the &amp;lt;tt&amp;gt; name &amp;lt;/tt&amp;gt; idiom.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:22&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:26&lt;br /&gt;
| 1. '''Which of the following variables contains the locations to search for'''&amp;lt;br/&amp;gt; python modules&lt;br /&gt;
** sys.pythonpath&lt;br /&gt;
** sys.path&lt;br /&gt;
** os.pythonpath&lt;br /&gt;
** os.path&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:38&lt;br /&gt;
| 2. A module should contain only functions. - True - False&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:43&lt;br /&gt;
| 3. The script &amp;lt;tt&amp;gt;utils.py&amp;lt;/tt&amp;gt; is in one of locations of PYTHONPATH and contains the following code and the code is given.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:00&lt;br /&gt;
| And now look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:04&lt;br /&gt;
| 1. &amp;lt;tt&amp;gt;sys.path&amp;lt;/tt&amp;gt; contains the locations to search for python modules.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:10&lt;br /&gt;
| 2. False is the answer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:13&lt;br /&gt;
| A module which contain a range of functions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:19&lt;br /&gt;
| 3. After doing &amp;lt;tt&amp;gt;import utils&amp;lt;/tt&amp;gt;, we can use the function &amp;lt;tt&amp;gt;show()&amp;lt;/tt&amp;gt; as,&lt;br /&gt;
&lt;br /&gt;
 utils.show within bracket double quotes hey&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:32&lt;br /&gt;
| So we hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:35&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C4/Using-python-modules/English-timed</id>
		<title>Python/C4/Using-python-modules/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C4/Using-python-modules/English-timed"/>
				<updated>2013-01-02T12:15:38Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- |0:01 | Hello Friends and Welcome to the spoken tutorial on 'Using Python Modules'.  |- | 0:06 | At the end of this tutorial, you will be ab…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:01&lt;br /&gt;
| Hello Friends and Welcome to the spoken tutorial on 'Using Python Modules'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to ,&lt;br /&gt;
&lt;br /&gt;
# Execute python scripts from command line.&lt;br /&gt;
# Use import in scripts.&lt;br /&gt;
# Import scipy and pylab modules.&lt;br /&gt;
# Use python standard modules and 3rd party modules.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:20&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Using plot interactively&amp;quot;, &amp;quot;Embellishing a plot&amp;quot; and &amp;quot;Saving plots&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:32&lt;br /&gt;
| Let us create a simple python script to print hello world. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:36&lt;br /&gt;
| Open your text editor and type the following,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:41&lt;br /&gt;
|print  within double quotes Hello world exclamation&lt;br /&gt;
print&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:02&lt;br /&gt;
| Now save this script as &amp;lt;tt&amp;gt;hello.py&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:11&lt;br /&gt;
| Start the ipython interpreter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:14&lt;br /&gt;
|Open the terminal and type ipython&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:20&lt;br /&gt;
| In the previous tutorials,we have seen how to run a script using the IPython interpreter using &amp;lt;tt&amp;gt;percentage run&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:29&lt;br /&gt;
|So type  percentage run hypen i hello.py &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:40&lt;br /&gt;
| but this is not the correct way of running a python script.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:45&lt;br /&gt;
| The correct method is to run it using the Python interpreter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:50&lt;br /&gt;
| Open the terminal and navigate to the directory where hello.py is,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:57&lt;br /&gt;
| now run the Python script as,python hello.py &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:12&lt;br /&gt;
| It executed the script and we got the output &amp;lt;tt&amp;gt;Hello World!&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:20&lt;br /&gt;
| The syntax is &amp;lt;tt&amp;gt;python space filename&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:24&lt;br /&gt;
| Now, we have a four plot problem where we have plotted four plots in a single figure. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:34&lt;br /&gt;
| Let us run that script from command line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:40&lt;br /&gt;
|Type python four underscore plot.py &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:50&lt;br /&gt;
| Oops! even though it was supposed to work, it didn't. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:55&lt;br /&gt;
| It gave an error &amp;lt;tt&amp;gt;linspace()&amp;lt;/tt&amp;gt; is not defined, which means that the function &amp;lt;tt&amp;gt;linspace()&amp;lt;/tt&amp;gt; is not available in the current name-space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:02 &lt;br /&gt;
| But if you try to run the same script using &amp;lt;tt&amp;gt;%run -i four underscore plot.py&amp;lt;/tt&amp;gt; in your IPython interpreter started with the option &amp;lt;tt&amp;gt; hypen pylab&amp;lt;/tt&amp;gt; it will work, because the &amp;lt;tt&amp;gt; hypen pylab&amp;lt;/tt&amp;gt; option does some work for us by importing the required modules to our name-space when ipython interpreter starts. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:25&lt;br /&gt;
| And thus we don't have to explicitly import modules.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:28&lt;br /&gt;
| So now let us try to fix the problem and run the script in command line,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:33&lt;br /&gt;
| add this line as the first line in the script,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:43&lt;br /&gt;
|from scipy import star&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:12&lt;br /&gt;
| Now let us run the script again,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:15&lt;br /&gt;
|Type python four underscore plot.py &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:25&lt;br /&gt;
| Now it gave another error -- plot not defined,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:32&lt;br /&gt;
| let us edit the file again and add this line as the second line in our script and save it,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:38&lt;br /&gt;
|So add the line as second line in four underscore plot.py and save &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:47&lt;br /&gt;
|from pylab import star&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:05&lt;br /&gt;
| And now, run the script,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:07&lt;br /&gt;
|So type python four underscore plot.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:19&lt;br /&gt;
| Yes! it worked. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:21&lt;br /&gt;
| So what did we do?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:24&lt;br /&gt;
| We actually imported the required modules using the keyword &amp;lt;tt&amp;gt;import&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:29&lt;br /&gt;
| It could also be done as by using, from scipy import linspace instead of, from scipy import *&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:39&lt;br /&gt;
| So in practice it is always good to use function names instead of asterisk or star. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:45&lt;br /&gt;
| If we use asterisk to import from a particular module then it will replace any existing functions with the same name in our name-space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:56&lt;br /&gt;
| So let us modify four underscore plot.py as, Hence we delete the first two lines of our code which we had added and add these lines&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:08&lt;br /&gt;
|Type from scipy import linspace &lt;br /&gt;
      from scipy import linspace comma  pi comma  sin &lt;br /&gt;
      from pylab import plot comma  legend comma  annotate&lt;br /&gt;
      from pylab import xlim comma  ylim comma  title comma  show&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:08&lt;br /&gt;
| Now let us try running the code again as,python four underscore plot.py and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:19&lt;br /&gt;
| It works! In this method we actually imported the functions to the current name-space. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:24&lt;br /&gt;
| There is one more way of doing it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:26&lt;br /&gt;
| And that is,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:35&lt;br /&gt;
| Notice that we use &amp;lt;tt&amp;gt;scipy.pi&amp;lt;/tt&amp;gt; instead of just &amp;lt;tt&amp;gt;pi&amp;lt;/tt&amp;gt; as in the previous method, and the functions are called as &amp;lt;tt&amp;gt;pylab.plot()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pylab.annotate()&amp;lt;/tt&amp;gt; and not as &amp;lt;tt&amp;gt;plot()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;annotate()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:55&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:01&lt;br /&gt;
| Write a script to plot a sine wave from minus two pi to two pi. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:09&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;&amp;lt;Pause&amp;gt; It can solved as,&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:13&lt;br /&gt;
| The first line we import the required functions &amp;lt;tt&amp;gt;linspace()&amp;lt;/tt&amp;gt; , &amp;lt;tt&amp;gt;sin()&amp;lt;/tt&amp;gt; and constant &amp;lt;tt&amp;gt;pi&amp;lt;/tt&amp;gt; from the module scipy. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:24&lt;br /&gt;
| The second and third line we import the functions &amp;lt;tt&amp;gt;plot()&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;legend()&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;show()&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;title()&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;xlabel()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ylabel()&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:34&lt;br /&gt;
| And the rest the code to generate the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:43&lt;br /&gt;
| We can run it as,python sine.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:50&lt;br /&gt;
|python sine.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:56&lt;br /&gt;
| As we can see, we our sine plot. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:01&lt;br /&gt;
| Let us move further in our topic.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:06&lt;br /&gt;
| Until now we have been learning about importing modules, now what is a module?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:11&lt;br /&gt;
| A module is simply a file containing Python definitions and statements. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:18&lt;br /&gt;
| Definitions from a module can be imported into other modules or into the main module.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:24&lt;br /&gt;
| Python has a very rich standard library of modules. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:29&lt;br /&gt;
| It is very extensive, offering a wide range of facilities. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:33&lt;br /&gt;
| Some of the standard modules are,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:36&lt;br /&gt;
| for Math: math, random for Internet access: urllib2, smtplib for System, Command line arguments: sys for Operating system interface: os for regular expressions: re for compression: gzip, zipfile, tarfile And there are lot more.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:13&lt;br /&gt;
| Find more information at Python Library reference, &amp;lt;tt&amp;gt;http://docs.python.org/library/&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:25&lt;br /&gt;
| There are a lot of other modules like pylab, scipy, Mayavi, etc which are not part of the standard python library.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:32&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:35&lt;br /&gt;
| In this tutorial, we have learnt to, 1. Run scripts from command line,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:39&lt;br /&gt;
| 2. Import modules by specifying the module name followed by an asterisk.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:45&lt;br /&gt;
| 3. Import only the required functions from modules by specifying the function name.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:50&lt;br /&gt;
| 4. Use python standard library.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:54&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:58&lt;br /&gt;
| 1. Which among this is correct ?&lt;br /&gt;
** from scipy import plot&lt;br /&gt;
** from numpy import plot&lt;br /&gt;
** from matplotlib import plot&lt;br /&gt;
** from pylab import plot&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:11&lt;br /&gt;
| 2. Which among these libraries is part of python standard library ?&lt;br /&gt;
** Mayavi&lt;br /&gt;
** scipy&lt;br /&gt;
** matplotlib&lt;br /&gt;
** urllib2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:23&lt;br /&gt;
| 3. Functions &amp;lt;tt&amp;gt;xlim()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ylim()&amp;lt;/tt&amp;gt; can be imported to the current name-space as,&lt;br /&gt;
** from pylab import xlim comma  ylim&lt;br /&gt;
** import pylab&lt;br /&gt;
** from scipy import xlim comma  ylim&lt;br /&gt;
** import scipy&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:44&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:49&lt;br /&gt;
| 1. The option &amp;lt;tt&amp;gt;from pylab import plot&amp;lt;/tt&amp;gt; is the correct one, since plot is a function of module module.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:59&lt;br /&gt;
| 2. &amp;lt;tt&amp;gt;urllib2&amp;lt;/tt&amp;gt; is a part of the python standard library.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:06&lt;br /&gt;
| 3. Functions &amp;lt;tt&amp;gt;xlim()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;ylim()&amp;lt;/tt&amp;gt; can be imported to the current name-space as, &amp;lt;tt&amp;gt;from pylab import xlim comma  ylim&amp;lt;/tt&amp;gt;.&lt;br /&gt;
	&lt;br /&gt;
|-&lt;br /&gt;
| 12:16&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:19&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C4/Advanced-features-of-functions/English-timed</id>
		<title>Python/C4/Advanced-features-of-functions/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C4/Advanced-features-of-functions/English-timed"/>
				<updated>2013-01-02T12:14:54Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and Welcome to the tutorial on 'advanced features of functions'.  |- | 0:06 | At the end of this tutorial, you will b…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and Welcome to the tutorial on 'advanced features of functions'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Assign default values to arguments, when defining functions.&lt;br /&gt;
# Define and call functions with keyword arguments.&lt;br /&gt;
# Learn some of the built-in functions available in Python standard library and the scientific computing libraries.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:23&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with functions&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:32&lt;br /&gt;
| Let us Start the ipython interpreter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:36&lt;br /&gt;
|ipython hypen pylab in command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:43&lt;br /&gt;
| Let's use the &amp;lt;tt&amp;gt;round&amp;lt;/tt&amp;gt; function as an example to understand what a default value of an argument means. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:49&lt;br /&gt;
| Let's type the following expressions in the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:52&lt;br /&gt;
|Type round within bracket 2.484 and hit enter.&lt;br /&gt;
Then type round within bracket 2.484 comma  2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:10&lt;br /&gt;
| Both the first expression and the second are calls to the &amp;lt;tt&amp;gt;round&amp;lt;/tt&amp;gt; function, but the first calls it with only one argument and the second calls it with two arguments. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:22&lt;br /&gt;
| By observing the output, we can guess that the first one is equivalent to call with the second argument being 0. 0 .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:30&lt;br /&gt;
| '''s.strip() # strips on spaces.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:35&lt;br /&gt;
| s.strip within single quote at the rate  # strips the string of 'at the rate' symbols.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:47&lt;br /&gt;
| Thus it can be said that here, blank space is the default argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:52&lt;br /&gt;
| plot within bracket x comma  y # plots with x vesus y using default line style. plot within bracket x comma  y comma  in single quote o # plots x versus y with circle markers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:14&lt;br /&gt;
| Hence, here when third argument is not provided, it shows default line style.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:20&lt;br /&gt;
| linspace within bracket 0 comma  2 star pi comma  100 # returns 100 points between 0 and 2pi linspace within bracket 0 comma  2 star pi # returns 50 points between 0 and 2pi&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:37&lt;br /&gt;
| Hence, the default for the third argument is 50.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:42&lt;br /&gt;
| Let's now define a simple function that uses default arguments. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:46&lt;br /&gt;
| We define a simple function that prints a welcome message to a person, given a greeting and his/her name.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:54&lt;br /&gt;
|So type in the terminal def welcome within bracket greet comma  name= within double quotes World colon (hit enter)&lt;br /&gt;
                         print greet comma  name (hit enter)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:18&lt;br /&gt;
| Let us first call the function with two arguments, one for &amp;lt;tt&amp;gt;greet&amp;lt;/tt&amp;gt; and other for &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:25&lt;br /&gt;
|So type welcome within bracket  within double quotes Hi comma   within double quotes Guido&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:35&lt;br /&gt;
| We get the expected welcome message, &amp;quot;Hi Guido&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:41&lt;br /&gt;
| Now let us call the function with just one argument &amp;quot;Hello&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:45&lt;br /&gt;
|So type welcome within bracket  within double quotes Hello&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:53&lt;br /&gt;
| &amp;quot;Hello&amp;quot; is treated as the &amp;lt;tt&amp;gt;greet&amp;lt;/tt&amp;gt; and we get &amp;quot;Hello World&amp;quot; as the output. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:59&lt;br /&gt;
| &amp;quot;World&amp;quot; is the default value for the argument &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:02&lt;br /&gt;
| Pause the video here,  try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:07&lt;br /&gt;
| '''Redefine the function &amp;lt;tt&amp;gt;welcome&amp;lt;/tt&amp;gt;, by interchanging it's''' arguments. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:11&lt;br /&gt;
| Place the &amp;lt;tt&amp;gt;name&amp;lt;/tt&amp;gt; argument with it's default value of &amp;quot;World&amp;quot; before the &amp;lt;tt&amp;gt;greet&amp;lt;/tt&amp;gt; argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:17&lt;br /&gt;
| Switch to the terminal for solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:20&lt;br /&gt;
|def welcome within bracket name= within double quotes World comma  greet colon (hit enter)&lt;br /&gt;
    print greet comma  name (hit enter)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:36&lt;br /&gt;
| We get an error that reads &amp;lt;tt&amp;gt;SyntaxError: non-default argument follows default argument&amp;lt;/tt&amp;gt;.Then ipython control line one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:47&lt;br /&gt;
| When defining a function all the argument with default values should come at the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:52&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:58&lt;br /&gt;
| '''See the definition of linspace using &amp;lt;tt&amp;gt;question mark&amp;lt;/tt&amp;gt; and make a note of all''' the arguments with default values are towards the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:09&lt;br /&gt;
| Switch to the terminal for solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:12&lt;br /&gt;
|linspace question mark hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:17&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;As we go on hitting the enter key, we the the number of arguments this command has. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:26&lt;br /&gt;
| Please read the content on your terminal. &amp;lt;pause&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:30&lt;br /&gt;
| Again,Pause the video here,try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:35&lt;br /&gt;
| '''Redefine the function &amp;lt;tt&amp;gt;welcome&amp;lt;/tt&amp;gt; with a default value of'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:41&lt;br /&gt;
| &amp;quot;Hello&amp;quot; to the &amp;lt;tt&amp;gt;greet&amp;lt;/tt&amp;gt; argument. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:44&lt;br /&gt;
| Then, call the function without any arguments.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:48&lt;br /&gt;
| Switch to the terminal for solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:51&lt;br /&gt;
|Type def welcome within bracket greet= within double quotes Hello comma  name= within double quotes World colon&lt;br /&gt;
    print greet comma  name&lt;br /&gt;
(After hitting enter type)&lt;br /&gt;
    welcome()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:17&lt;br /&gt;
| As we can see, we get the output as &amp;lt;tt&amp;gt;Hello World&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:20&lt;br /&gt;
| Let us now learn what keyword arguments or named arguments are.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:26&lt;br /&gt;
| We shall refer to them as keyword arguments, henceforth.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:31&lt;br /&gt;
| When you are calling functions in Python, you don't need to remember the order in which to pass the arguments. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:38&lt;br /&gt;
| Instead, you can use the name of the argument to pass it a value. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:44&lt;br /&gt;
| This slide shows a few function calls that use keyword arguments. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:52&lt;br /&gt;
| &amp;lt;tt&amp;gt;loc&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;linewidth&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;xy&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;labels&amp;lt;/tt&amp;gt; are being called with keyword arguments.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:00&lt;br /&gt;
| Let us try and understand this better using the &amp;lt;tt&amp;gt;welcome&amp;lt;/tt&amp;gt; function that we have been using all along. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:07&lt;br /&gt;
| Let us call it in different ways and observe the output to see how keyword arguments work.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:14&lt;br /&gt;
|So in terminal type welcome()&lt;br /&gt;
&lt;br /&gt;
welcome within bracket  within double quotes Hello comma   within double quotes James&lt;br /&gt;
&lt;br /&gt;
welcome within bracket  within double quotes Hi comma  name= within double quotes Guido&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:37&lt;br /&gt;
| When no keyword is specified, the arguments are allotted based on their position. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:42&lt;br /&gt;
| So, &amp;quot;Hi&amp;quot; is the value of the argument &amp;lt;tt&amp;gt;greet&amp;lt;/tt&amp;gt; and name is passed the value &amp;quot;Guido&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:48&lt;br /&gt;
| If we type in the terminal welcome within bracket name= within double quotes Guido comma  greet= within double quotes Hey exclamation &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:02&lt;br /&gt;
| When keyword arguments are used, the arguments can be called in any order. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:07&lt;br /&gt;
| And if we call our function as,welcome within bracket name=&amp;quot;Guido&amp;quot; comma  &amp;quot;Hey&amp;quot; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:17&lt;br /&gt;
| This call returns an error that reads, &amp;lt;tt&amp;gt;non-keyword arg after keyword arg&amp;lt;/tt&amp;gt;. Python expects all the keyword to be present towards the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:30&lt;br /&gt;
| That brings us to the end of what we wanted to learn about &amp;lt;tt&amp;gt;keyword&amp;lt;/tt&amp;gt; arguments.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:37&lt;br /&gt;
| Before defining a function of your own, make sure that you check the standard library, for a similar function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:43&lt;br /&gt;
| Python is popularly called a &amp;quot;Batteries included&amp;quot; language, for the huge library that comes along with it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:55&lt;br /&gt;
| Math functions - abs, sin, .... Plot functions - plot, bar, pie ... Boolean functions - and, or, not ...&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:11&lt;br /&gt;
| Apart from the standard library there are other libraries like &amp;lt;tt&amp;gt;pylab&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;scipy&amp;lt;/tt&amp;gt;, etc which have a huge collection of functions for scientific purposes.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:22&lt;br /&gt;
| '''pylab''' has&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:23&lt;br /&gt;
| plot, bar, contour, boxplot, errorbar, log, polar, quiver, semilog&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:32&lt;br /&gt;
| '''scipy (modules)'''has&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:35&lt;br /&gt;
| fftpack, stats, linalg, ndimage, signal, optimize, integrate&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:46&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:48&lt;br /&gt;
| In this tutorial, we have learnt to, 1. Define functions with default arguments.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:53&lt;br /&gt;
| 2. Call functions using keyword arguments.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:55&lt;br /&gt;
| 3. Use the range of functions available in the Python standard library and the Scientific Computing related packages.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:04&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:08&lt;br /&gt;
| 1. All arguments of a function cannot have default values. - True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:14&lt;br /&gt;
| 2. The following is a valid function definition. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:17&lt;br /&gt;
| True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:21&lt;br /&gt;
|  def seperator within bracket count=40 comma  char comma  show=False colon&lt;br /&gt;
  if show colon&lt;br /&gt;
  print char  star  count&lt;br /&gt;
  return char  star  count&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:36&lt;br /&gt;
| 3. When calling a function, the arguments should always be in the order in which they are defined.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:45&lt;br /&gt;
|  the arguments can be in any order.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:47&lt;br /&gt;
|  '''only keyword arguments can be in any order, but should be called'''&amp;lt;br/&amp;gt; at the beginning.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:56&lt;br /&gt;
|  only keyword arguments can be in any order, but should be called at the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:10&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:13&lt;br /&gt;
| 1.False. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:15&lt;br /&gt;
| All arguments of a Python function can have default values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:21&lt;br /&gt;
| 2. False. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:23&lt;br /&gt;
| All parameters with default arguments should be defined at the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:27&lt;br /&gt;
| 3. When calling a function,only keyword arguments can be in any order, but should be called at the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:35&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:39&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C4/Getting-started-with-functions/English-timed</id>
		<title>Python/C4/Getting-started-with-functions/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C4/Getting-started-with-functions/English-timed"/>
				<updated>2013-01-02T12:13:55Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and welcome to the tutorial 'Getting started with functions'.  |- |  0:05 | At the end of this tutorial, you will be …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and welcome to the tutorial 'Getting started with functions'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Define a function.&lt;br /&gt;
# Define functions with arguments.&lt;br /&gt;
# Learn about docstrings.&lt;br /&gt;
# Learn about function return value.&lt;br /&gt;
# Read code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:16&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Conditionals&amp;quot; and &amp;quot;Loops&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:22&lt;br /&gt;
| While writing code, we always want to reduce the number of lines of code, and functions is a way of reusing the code. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:32&lt;br /&gt;
| Thus the same lines of code can be used as many times as needed. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:35&lt;br /&gt;
| A function is a portion of code within a larger program that performs a specific task and is relatively independent of the remaining code. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:43&lt;br /&gt;
| Now let us get more familiar with functions,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:48&lt;br /&gt;
| Consider a mathematical function f of x = x square. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:53&lt;br /&gt;
| Here x is a variable and with different values of x the value of function will change. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:58&lt;br /&gt;
| When x is one, f(1) will return the value 1 and f(2) will return us the value 4. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:05&lt;br /&gt;
| Let us now see how to define the function f of x in python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:10&lt;br /&gt;
| Start your ipython interpreter by typing,ipython in command line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:17&lt;br /&gt;
| Let us define our function f of x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:19&lt;br /&gt;
|So type def f within bracket x colon&lt;br /&gt;
         return x star x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:29&lt;br /&gt;
|Star denotes multipication&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:34&lt;br /&gt;
| Well that defined the function, so before learning what we did let us see if it returns the expected values, try,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:45&lt;br /&gt;
|f(1)&lt;br /&gt;
 f(2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:52&lt;br /&gt;
| Yes, it returned 1 and 4 respectively. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:55&lt;br /&gt;
| And now let us see what we did. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:58&lt;br /&gt;
| We wrote two lines: The first line &amp;lt;tt&amp;gt;def f of x &amp;lt;/tt&amp;gt; is used to define the name and the parameters to the function, and the second line is used to fix what the function is supposed to return. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:12&lt;br /&gt;
| &amp;lt;tt&amp;gt;def&amp;lt;/tt&amp;gt; is a keyword and &amp;lt;tt&amp;gt;f&amp;lt;/tt&amp;gt; is the name of the function and &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; the parameter of the function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:19&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:24&lt;br /&gt;
| '''Write a python function named &amp;lt;tt&amp;gt;cube&amp;lt;/tt&amp;gt; which computes the cube of''' a given number n.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:31&lt;br /&gt;
| Switch to your terminal for solution. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:33&lt;br /&gt;
| The problem can be solved as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:36&lt;br /&gt;
|In the terminal type def cube within bracket n colon&lt;br /&gt;
                      return n star star 3&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:48&lt;br /&gt;
| Let us check whether our function returns the cube of a number or not&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:53&lt;br /&gt;
|So type cube within bracket 2 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:00&lt;br /&gt;
| It returned 8,which means we have defined our function,the right way. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:05&lt;br /&gt;
| And now let us see how to write functions without arguments.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:09&lt;br /&gt;
| let us define a new function called &amp;lt;tt&amp;gt;greet&amp;lt;/tt&amp;gt; which will print &amp;lt;tt&amp;gt;Hello World&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:15&lt;br /&gt;
|So type def greet() colon and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:26&lt;br /&gt;
|Then type print in double quotes Hello World exclamation&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:39&lt;br /&gt;
| now we call the function as,greet() and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:45&lt;br /&gt;
| Well that is a function which takes no arguments. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:49&lt;br /&gt;
| Also note that it is not mandatory for a function to return values. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:53&lt;br /&gt;
| The function &amp;lt;tt&amp;gt;greet&amp;lt;/tt&amp;gt; neither takes any argument nor returns any value.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:57&lt;br /&gt;
| Now let us see how to write functions with more than one argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:03&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:08&lt;br /&gt;
| Write a python function named &amp;lt;tt&amp;gt;avg&amp;lt;/tt&amp;gt; which computes the average of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:16&lt;br /&gt;
| Switch to your terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:19&lt;br /&gt;
|Type def avg within bracket a comma b colon&lt;br /&gt;
      return  within bracket a + b divided by 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:36&lt;br /&gt;
|For division we use slash.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:42&lt;br /&gt;
| Let us test our function,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:44&lt;br /&gt;
|Type on terminal avg within bracket 20 comma  30 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:53&lt;br /&gt;
| We get the correct average, 25.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:56&lt;br /&gt;
| Thus if we want a function to accept more arguments, we just list them separated with a comma between the parenthesis after the function's name in the &amp;lt;tt&amp;gt;def&amp;lt;/tt&amp;gt; line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:06&lt;br /&gt;
| It is always a good practice to document the code that we write, and for a function we define, we should write an abstract of what the function does, and that is called a docstring. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:19&lt;br /&gt;
| Let us modify the function &amp;lt;tt&amp;gt;avg&amp;lt;/tt&amp;gt; and add docstring to it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:24&lt;br /&gt;
| Do the following,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:25&lt;br /&gt;
|So now in the terminal type def avg within bracket a comma b colon &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:38&lt;br /&gt;
|Then in triple double quote you can type avg takes two numbers as input (a &amp;amp; b), and returns the average of a and b&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:50&lt;br /&gt;
|Then type return return  within bracket a+b divided by 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:02&lt;br /&gt;
|Note that we have a syntax error.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:09&lt;br /&gt;
|The error that we saw here is because of indentation error in return(a+b)/2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:15&lt;br /&gt;
|So just input that command again.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:25&lt;br /&gt;
|So type def avg within bracket a comma b colon&lt;br /&gt;
&lt;br /&gt;
  &amp;quot;&amp;quot;&amp;quot; avg takes two numbers as input (a &amp;amp; b), and&lt;br /&gt;
returns the average of a and b&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
return  within bracket a+b divided by 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:45&lt;br /&gt;
| Note that docstrings are entered in the immediate line after the function definition and put as a triple quoted string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:55&lt;br /&gt;
| And here as far as the code functionality is concerned, we didn't do anything.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:00&lt;br /&gt;
|  We just added an abstract of what the function does.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:03&lt;br /&gt;
| Now try this in the ipython interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:07&lt;br /&gt;
|Type avg and question mark.&lt;br /&gt;
|-&lt;br /&gt;
| 7:12&lt;br /&gt;
| It displays the docstring as we gave it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:16&lt;br /&gt;
| Thus docstring is a good way of documenting the function we write.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:21&lt;br /&gt;
| Now type comma f question mark and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:29&lt;br /&gt;
| It does have a docstring associated with it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:37&lt;br /&gt;
|Sorry It doesnot have a docstring associated with it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:40&lt;br /&gt;
| Also we cannot infer anything from the function name, and thus we are forced to read the code to understand about the function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:48&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:54&lt;br /&gt;
| Add docstring to the function f.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:59&lt;br /&gt;
| We need to define the function again to add docstring to the function &amp;lt;tt&amp;gt;f&amp;lt;/tt&amp;gt; and we do it as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:06&lt;br /&gt;
| def f within bracket x colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:13&lt;br /&gt;
|  &amp;quot;&amp;quot;&amp;quot;Accepts a number x as argument and, returns the square of the number x.&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:24&lt;br /&gt;
|  return x star x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:32&lt;br /&gt;
| Let us solve one more exercise &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:34&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:41&lt;br /&gt;
| '''Write a python function named &amp;lt;tt&amp;gt;circle&amp;lt;/tt&amp;gt; which returns the''' area and perimeter of a circle given radius &amp;lt;tt&amp;gt;r&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:52&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:57&lt;br /&gt;
| The problem requires us to return two values instead of one which we were doing till now. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:03&lt;br /&gt;
| We can solve the problem as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:05&lt;br /&gt;
|So now we can type in terminal &lt;br /&gt;
  def circle within bracket r colon&lt;br /&gt;
 &amp;quot;&amp;quot;&amp;quot;returns area and perimeter of a circle given radius r&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
 pi = 3.14&lt;br /&gt;
 area = pi star r star r&lt;br /&gt;
 perimeter = 2 star pi star r&lt;br /&gt;
 return area comma  perimeter and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:04&lt;br /&gt;
| A python function can return any number of values. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:07&lt;br /&gt;
| There is no restriction for it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:09&lt;br /&gt;
| Let us call the function &amp;lt;tt&amp;gt;circle&amp;lt;/tt&amp;gt; as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:12&lt;br /&gt;
|Typing it on terminal a comma  p = circle within bracket 6&lt;br /&gt;
			print a&lt;br /&gt;
			print p&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:39&lt;br /&gt;
| Now we have done enough coding, let us do some code reading exercise,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:46&lt;br /&gt;
| Pause here and try to figure out what the function &amp;lt;tt&amp;gt;what&amp;lt;/tt&amp;gt; does.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:54&lt;br /&gt;
| '''def what within bracket  n  colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:58&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;if n less than 0 colon n = -n while n greater than 0 colon&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:08&lt;br /&gt;
| '''if n modulo 2 == 1 colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:12&lt;br /&gt;
| return False&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:14&lt;br /&gt;
| n slash = 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:19&lt;br /&gt;
| And the next line is return True&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:23&lt;br /&gt;
| continue from paused state It will return true if &amp;lt;tt&amp;gt;n modulo 2&amp;lt;/tt&amp;gt; is not equal to 1 and will return false, otherwise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:36&lt;br /&gt;
| The function here returns &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; if all the digits of the number &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; are even, otherwise it returns &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:45&lt;br /&gt;
| Now one more code reading exercise,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:51&lt;br /&gt;
|So it is given def even underscore digits within bracket n  colon&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;returns True if all the digits in the number n are even, returns False if all the digits in the number n are not even&amp;quot;&amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:13&lt;br /&gt;
|Then next line if n less than 0 colon n = -n while n greater than 0 colon &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:24&lt;br /&gt;
|The next line if n modulo 2 == 1 colon&lt;br /&gt;
		return False&lt;br /&gt;
		n slash= 10&lt;br /&gt;
		return True &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:40&lt;br /&gt;
| Pause here and try to figure out what the function &amp;lt;tt&amp;gt;what&amp;lt;/tt&amp;gt; does.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:48&lt;br /&gt;
| '''def what  within bracket n  colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:52&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;i = 1 while i star i les than n colon&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:59&lt;br /&gt;
| i += 1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:02&lt;br /&gt;
| return i star i == n comma  i&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:07&lt;br /&gt;
| continue from paused state The function returns two values. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:11&lt;br /&gt;
| One it returns the result of the while statement whether true of false, and second it prints the value that ''ii`'' currently holds.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:23&lt;br /&gt;
| Here, the function returns &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; and the square root of &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; if n is a perfect square, otherwise it returns &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt; and the square root of the next perfect square.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:37&lt;br /&gt;
|So we look at that&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:40&lt;br /&gt;
|def is underscore perfect underscore square within bracket  n colon&lt;br /&gt;
&amp;quot;&amp;quot;&amp;quot;returns True and square root of n, if n is a perfect square, otherwise returns False and the square root of the next perfect square&amp;quot;&amp;quot;&amp;quot; i = 1 while i star i less than n colon&lt;br /&gt;
i += 1&lt;br /&gt;
return i star i == n comma  i &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:14&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:17&lt;br /&gt;
| In this tutorial, we have learnt to, 1. Define functions in Python by using the keyword &amp;lt;tt&amp;gt;def&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:22&lt;br /&gt;
| 2. Call the function by specifying the function name.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:25&lt;br /&gt;
| 3. Assign a docstring to a function by putting it as a triple quoted string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:33&lt;br /&gt;
| 4. Pass parameters to a function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:37&lt;br /&gt;
| 5. Return values from a function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:39&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:42&lt;br /&gt;
| 1. What will the function do?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:46&lt;br /&gt;
| def what(x)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:48&lt;br /&gt;
| return x star x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:50&lt;br /&gt;
| Returns the square of x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:52&lt;br /&gt;
| Returns x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:54&lt;br /&gt;
| Function doesn't have docstring&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
| 14:57&lt;br /&gt;
| Error&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:59&lt;br /&gt;
| 1. How many arguments can be passed to a python function?&lt;br /&gt;
** None&lt;br /&gt;
** One&lt;br /&gt;
** Two&lt;br /&gt;
** Any&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:07&lt;br /&gt;
| 1. Write a function which calculates the area of a rectangle.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:12&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:14&lt;br /&gt;
| 1.The function will result into an error due to the use of wrong syntax in defining the function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:27&lt;br /&gt;
| The function line should always end with a colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:32&lt;br /&gt;
|  Any number of arguments can be passed to a python function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:37&lt;br /&gt;
|  As we know, area of a rectangle is product of it's length and breadth. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:41&lt;br /&gt;
| Hence, we define our function as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:42&lt;br /&gt;
| def area within bracket l comma b colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:47&lt;br /&gt;
| return l star b&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:51&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:55&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Sets/English-timed</id>
		<title>Python/C3/Sets/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Sets/English-timed"/>
				<updated>2013-01-02T12:12:03Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and welcome to the tutorial on 'Sets'.  |- | 0:05 | At the end of this tutorial, you will be able to,  # Create sets from…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to the tutorial on 'Sets'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Create sets from lists.&lt;br /&gt;
# Perform union, intersection and symmetric difference operations.&lt;br /&gt;
# Check if a set is a subset of other.&lt;br /&gt;
# Understand various similarities with lists like length and containership.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:25&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with List&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:35&lt;br /&gt;
|Now, type ipython in the command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:43&lt;br /&gt;
| &lt;br /&gt;
So, What are sets?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:46&lt;br /&gt;
| Sets are data structures which contain unique elements. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:49&lt;br /&gt;
|In other words, duplicates are not allowed in sets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:54&lt;br /&gt;
| Lets look at how to input sets. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:59&lt;br /&gt;
|So type a underscore list is equal to within brackets 1,2,1,4,5,6,2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:15&lt;br /&gt;
|Then a is equal to set in brackets a underscore list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:25&lt;br /&gt;
|Then type a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:28&lt;br /&gt;
| We can see that duplicates are removed and the set contains only unique elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:31&lt;br /&gt;
| Now let us perform some operations on sets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:35&lt;br /&gt;
| For this, we shall first create a pair of sets&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:40&lt;br /&gt;
| f10 is equal to set of within brackets and square brackets 1,2,3,5,8&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:54&lt;br /&gt;
| p10 is equal to set of within brackets and square brackets 2,3,5,7.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:07&lt;br /&gt;
|f10 is the set of fibonacci series numbers from 1 to 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:19&lt;br /&gt;
|p10 is the set of prime numbers from 1 to 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:22&lt;br /&gt;
|Various operations can be performed on sets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
| For example, The vertical bar and in bracket  pipe character stands for union.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:37&lt;br /&gt;
|So type f10 then a vertical bar p10 and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:46&lt;br /&gt;
| It gave the union of f10 and p10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:50&lt;br /&gt;
|The ampersand character stands for intersection.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:53&lt;br /&gt;
|So type f10 ampersand p10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:00 &lt;br /&gt;
| It gave the intersection of f10 and p10 similarly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:05&lt;br /&gt;
|f10 - p10 gives all the elements that are in f10 but not in p10 .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:13&lt;br /&gt;
|So type f10 hyphen p10 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:22&lt;br /&gt;
|and f10 charat p10 gives all the elements in f10 union p10 but not in f10 intersection p10. So type f10 charat p10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:40&lt;br /&gt;
| In mathematical terms, it gives the symmetric difference.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:46&lt;br /&gt;
|Sets also support checking of subsets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:50&lt;br /&gt;
|So lets type b is equal to within brackets and square brackets 1,2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:00&lt;br /&gt;
|Then b is less than f10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:05 &lt;br /&gt;
| It gives a &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; since b is a proper subset of f10. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:09&lt;br /&gt;
|Similarly, type f10 less than f10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:15&lt;br /&gt;
| It gives a &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt; since f10 is not a proper subset. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:19&lt;br /&gt;
|Hence the right way to do would be f10 less than or equal to f10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:31 &lt;br /&gt;
| we get a &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; since every set is a subset of itself.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:37&lt;br /&gt;
|Sets can be iterated upon just like lists and tuples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:42&lt;br /&gt;
|for i in f10 colon in the command and then type print i comma&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:01&lt;br /&gt;
| It prints the elements of f10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:03&lt;br /&gt;
|The length and containership check on sets is similar as in lists and tuples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:12&lt;br /&gt;
|So type len within brackets f10 and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:22&lt;br /&gt;
|And It shows 5, type 1 in f10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:27&lt;br /&gt;
|Then type 2 in f10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
| And prints &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; respectively&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:45&lt;br /&gt;
|Now, pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:50&lt;br /&gt;
| '''&amp;lt;nowiki&amp;gt;Given a list of marks, marks is equal to within square brackets 20, 23, 22, 23, 20, 21, 23&amp;lt;/nowiki&amp;gt;'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:01&lt;br /&gt;
|list all the duplicates&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:04&lt;br /&gt;
| Duplicates marks are the marks left out when we remove each element of the list exactly one time.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:13&lt;br /&gt;
|So type marks is equal to within square brackets 20,23,22,23,20,21,23.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:33&lt;br /&gt;
|Then type marks underscore set is equal to set within bracket marks.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:44&lt;br /&gt;
|then for mark in marks underscore set colon, then marks dot remove within brackets mark.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:05 &lt;br /&gt;
| We are now left with only duplicates in the list &amp;lt;tt&amp;gt;marks&amp;lt;/tt&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:10&lt;br /&gt;
|Hence Type duplicates is equal to set within brackets marks and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:24&lt;br /&gt;
|Then type duplicate.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:27&lt;br /&gt;
|Hence, We obtained our required solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:30&lt;br /&gt;
| This brings us to the end of the tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:34&lt;br /&gt;
| In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:36&lt;br /&gt;
| Make sets from lists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7;37&lt;br /&gt;
| Perform union, intersection and symmetric difference operations. by using the operators ''|'', ''&amp;amp;'' and ''^'' respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:49&lt;br /&gt;
|Check if a set is a subset of other using the ''&amp;lt;nowiki&amp;gt;&amp;lt;&amp;lt;/nowiki&amp;gt;'' and ''&amp;lt;nowiki&amp;gt;&amp;lt;=&amp;lt;/nowiki&amp;gt;'' operators.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:58&lt;br /&gt;
|Then, Understand various similarities with lists like length and containership.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:05&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:09&lt;br /&gt;
|1. First one, If &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;a is equal to within square brackets 1, 1, 2, 3, 3, 5, 5, 8&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:18&lt;br /&gt;
| And What is set(a)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:23&lt;br /&gt;
|The options are &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:26&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;set within brackets and square brackets 1, 1, 2, 3, 3, 5, 5, 8&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:31&lt;br /&gt;
|Second one &amp;lt;nowiki&amp;gt;set within brackets 1, 2, 3, 5, 8&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:36&lt;br /&gt;
| Then the third option &amp;lt;nowiki&amp;gt;set([1, 2, 3, 3, 5, 5])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:41&lt;br /&gt;
| Then the last option is Error.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:43&lt;br /&gt;
|2. Second question,  &amp;lt;tt&amp;gt;'''&amp;lt;nowiki&amp;gt;odd is equal to set within brackets 1, 3, 5, 7, 9&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;squares is equal to set within brackets 1, 4, 9, 16&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:57&lt;br /&gt;
|'''&amp;lt;br/&amp;gt; How do you find the symmetric difference of these two sets?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:02&lt;br /&gt;
|3. The third questions is, &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is a set.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:05&lt;br /&gt;
| how do you check if a variable &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; exists in &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:11&lt;br /&gt;
| Now And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:15&lt;br /&gt;
|1. First answer is, set of a will have all the common elements in the list &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;, that is &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;set within brackets 1, 2, 3, 5, 8&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:28&lt;br /&gt;
|2. The Second answer is , To find the symmetric difference between two sets, we use the operator charat.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:37&lt;br /&gt;
| So type odd charat squares&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:42&lt;br /&gt;
|3. Final answer is, To check the containership, we say,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:45&lt;br /&gt;
|b in a&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:50&lt;br /&gt;
| So Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:53&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Dictionaries/English-timed</id>
		<title>Python/C3/Dictionaries/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Dictionaries/English-timed"/>
				<updated>2013-01-02T12:10:37Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:01 | Hello friends and Welcome to the spoken tutorial on 'dictionaries'.  |- | 0:05  | At the end of this tutorial, you will be able to,  # …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and Welcome to the spoken tutorial on 'dictionaries'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05 &lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Create dictionaries.&lt;br /&gt;
# Add and delete data from dictionaries.&lt;br /&gt;
# Retrieve data from dictionaries.&lt;br /&gt;
# Check for container-ship of keys.&lt;br /&gt;
# Iterating  over elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:20&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Basic datatypes and operators&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:27 &lt;br /&gt;
| A dictionary in general, is designed to look up for meanings of words.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:35&lt;br /&gt;
| Similarly, Python dictionary is also designed to look up for a specific key and retrieve the corresponding value. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:43&lt;br /&gt;
|Dictionaries are data structures that provide key-value mappings. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:47&lt;br /&gt;
|Dictionaries are similar to lists except that instead of the values having integer indexes, dictionaries have keys or strings as indexes.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:58&lt;br /&gt;
| We start our ipython interpreter as, ipython&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:07&lt;br /&gt;
| Let us start by creating an empty dictionary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:12&lt;br /&gt;
| Type the following in your IPython interpreter,mt underscore dict = closing curly brackets&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:25&lt;br /&gt;
| Notice that unlike lists, curly braces are used to define a &amp;lt;tt&amp;gt;dictionary&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
| Now let us see how to create a non-empty dictionary,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:37&lt;br /&gt;
|so type extensions = open curly brackets  in single quotes jpg colon  'JPEG Image' comma  'py'  colon  'Python script' comma &lt;br /&gt;
&lt;br /&gt;
'html'  colon  'Html document' comma pdf  colon  Portable Document Format close curly brackets&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:08&lt;br /&gt;
| Notice that each key-value pair is separated by a comma.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:17&lt;br /&gt;
| and each key and value are separated using a colon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:23&lt;br /&gt;
| Here, we have defined four entries in the dictionary extensions. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:29&lt;br /&gt;
|The keys are jpg comma  py comma  html comma  and pdf.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:36&lt;br /&gt;
|Simply type,extensions in the interpreter to see the content of the dictionary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:40&lt;br /&gt;
|So type extensions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:45 &lt;br /&gt;
| Notice that, in dictionaries, the order cannot be predicted and you can see that the values are not in the order that we entered in.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:53&lt;br /&gt;
| Like lists, the elements in a dictionary can be accessed using the index, here the index is the key.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:06&lt;br /&gt;
| We type, print extensions within closing brackets and single quotes jpg.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:25&lt;br /&gt;
| It printed JPEG Image. And now type print extensions within square brackets zip.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:42&lt;br /&gt;
| Well it gave us an error, saying that the key 'zip' is not in the dictionary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:48&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;So Pause here for some time and try few more keys.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:52&lt;br /&gt;
| Also try jpg in capital letters. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:58&lt;br /&gt;
|&amp;lt;continue from paused state&amp;gt; Well that was about creating dictionaries, now how do we add or delete items.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:09&lt;br /&gt;
| We can add new items into dictionaries as,&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:13&lt;br /&gt;
|Type extensions within square brackets and single quotes cpp is equal to in single quotes C++ then code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:36&lt;br /&gt;
| and delete items using the &amp;lt;tt&amp;gt;del&amp;lt;/tt&amp;gt; keyword as, type del space extensions within square brackets and single quotes pdf.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:51&lt;br /&gt;
| Let us check the content of the dictionary now,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:54&lt;br /&gt;
|So type extensions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:57&lt;br /&gt;
| So the changes have been made.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:59&lt;br /&gt;
| Now let us try one more thing, type extensions within square brackets and in single quotes cpp is equal to in single quote C++ and source code. then type again extensions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:21&lt;br /&gt;
| As you can see, it neither added a new thing nor gave an error, but it simply replaced the existing value with the new one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:29&lt;br /&gt;
|Now let us learn how to check if a particular key is present in the dictionary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
| For that we can use the method &amp;lt;tt&amp;gt;in&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:37&lt;br /&gt;
|So type within single quotes py in extensions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:45&lt;br /&gt;
|Then type within single quotes odt in extensions. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:53&lt;br /&gt;
| It will return &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; if the key is found in the dictionary, and will return &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt; if key is not present.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:00&lt;br /&gt;
| Note that we can check only for container-ship of keys in dictionaries and not values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:07&lt;br /&gt;
| Now let us see how to retrieve the keys and values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:10&lt;br /&gt;
| We can use the method &amp;lt;tt&amp;gt;keys()&amp;lt;/tt&amp;gt; for getting a list of the keys in a particular dictionary and the method &amp;lt;tt&amp;gt;values()&amp;lt;/tt&amp;gt; for getting a list of values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:20&lt;br /&gt;
| Let us try them, type extensions dot keys closing brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:31&lt;br /&gt;
| It returned the &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; of keys in the dictionary extensions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:35&lt;br /&gt;
| And now the other one is extensions dot values and closing brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:42&lt;br /&gt;
| It returned the &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; of values in the dictionary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:45&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:49&lt;br /&gt;
| Print the keys and values in the dictionary one by one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:54&lt;br /&gt;
| Switch to terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:58&lt;br /&gt;
|Type for each in extensions dot keys closing brackets colon then,&lt;br /&gt;
    print each comma within double quotes hyphen hyphen greater symbol, extensions and within closing brackets each.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:35&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:39&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:41&lt;br /&gt;
|1. Create dictionaries namely -- - empty dictionaries - dictionaries with data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:45&lt;br /&gt;
|2. Access elements in the dictionaries using the keys.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:49&lt;br /&gt;
|3. Add elements to a dictionary by assigning a key value.&lt;br /&gt;
|-&lt;br /&gt;
|7:55&lt;br /&gt;
|4. Delete elements from a dictionary by using the function &amp;lt;tt&amp;gt;del&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:00&lt;br /&gt;
|5. Retrieve the keys and values by using the methods &amp;lt;tt&amp;gt;.keys()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;.values()&amp;lt;/tt&amp;gt; respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:06&lt;br /&gt;
|6. Iterate over elements of a dictionary using a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:11&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:15&lt;br /&gt;
|1. First one, Container-ship of values can be checked in a python dictionary - true or false.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:22&lt;br /&gt;
|2. Second one is, Consider the python dictionary x is equal to within curly brackets 'a' colon ['a','b','c'], 'b' colon (1, 2, 3), 1 colon then again another curly braces 1 colon 'one'comma 2 colon 'two' comma 10 colon within curly brackets 10 colon 'ten', 11 colon 'eleven' and close the curly brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:52&lt;br /&gt;
| What will the following code return?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:57&lt;br /&gt;
|&amp;lt;br/&amp;gt; &amp;lt;tt&amp;gt;(1, 2, 3) in x.values()&amp;lt;/tt&amp;gt;. True. False&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:05&lt;br /&gt;
|Then container-ship of values cannot be checked in dictionaries&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
| The dictionary is invalid&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:13&lt;br /&gt;
| So Lets look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:16&lt;br /&gt;
|1.The answer of first one, False. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:19&lt;br /&gt;
| Container-ship of only keys can be checked in a python dictionary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:27&lt;br /&gt;
|2. Second one is, True&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:31&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:35&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-tuples/English-timed</id>
		<title>Python/C3/Getting-started-with-tuples/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-tuples/English-timed"/>
				<updated>2013-01-02T12:09:40Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and welcome to the tutorial on &amp;quot;getting started with tuples&amp;quot;.  |- | 0:05 | At the end of the tutorial, you will be able t…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to the tutorial on &amp;quot;getting started with tuples&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of the tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Understand of what tuples are.&lt;br /&gt;
# Compare them with lists.&lt;br /&gt;
# Know why they are needed and where to use them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:15&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with lists&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:21&lt;br /&gt;
| Let us start our ipython interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:23&lt;br /&gt;
|Type ipython and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:27&lt;br /&gt;
| Let's get started by defining a tuple. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:29&lt;br /&gt;
|A tuple is defined by enclosing parentheses around a sequence of items separated by commas. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:39&lt;br /&gt;
|It is similar to defining a list except that parentheses are used instead of square brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:45&lt;br /&gt;
|So type t is equal to within brackets 1, 2.5, &amp;quot;hello&amp;quot;,-4, &amp;quot;world&amp;quot;, 1.24,5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:02&lt;br /&gt;
| The items in the tuple are indexed using numbers and can be accessed by using their position.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:10&lt;br /&gt;
| For example,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:11&lt;br /&gt;
|First you must type t&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:18&lt;br /&gt;
|Then t within square brackets 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:24&lt;br /&gt;
| It prints -4 which is the fourth item of the tuple.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:29&lt;br /&gt;
| Similarly type t within square brackets 1 colon 5 colon 2 and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:40&lt;br /&gt;
|It prints the corresponding slice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:42&lt;br /&gt;
|This behaviour is similar to that of lists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:46&lt;br /&gt;
| But the difference can be seen when we try to change an element in the tuple.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:51&lt;br /&gt;
|So type t within square brackets 2 is equal to within double quotes Hello, H is capital.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:05&lt;br /&gt;
| We can see that, it raises an error saying 'tuple object does not support item assignment'. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:10&lt;br /&gt;
|Tuples are immutable, and hence cannot be changed after creation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:13&lt;br /&gt;
|Then, what is the use of tuples?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:16&lt;br /&gt;
| We shall understand that soon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:19&lt;br /&gt;
| But let us look at a simple problem of swapping values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:24&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:30&lt;br /&gt;
| Given, a is equal to 5 and b is equal to 7.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:33&lt;br /&gt;
| Swap the values of a and b.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:38&lt;br /&gt;
| Switch to terminal of solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:40&lt;br /&gt;
|Type a is equal to 5, then b is equal to 7 , then type a and then b, you can see the values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:50&lt;br /&gt;
| We now create a variable say, temp and swap the values using this variable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:56&lt;br /&gt;
|So type temp is equal to a.Then a is equal to b ;then type b is equal to temp.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:08&lt;br /&gt;
|Then type a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:10&lt;br /&gt;
|Then b.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:13&lt;br /&gt;
| This is the traditional approach&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:16&lt;br /&gt;
| So let us do it the python way.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:21&lt;br /&gt;
|So type a; then b; then a comma b is equal to b comma a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:33&lt;br /&gt;
|then a ; then b gives the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:38&lt;br /&gt;
| We see that the values are swapped.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:43&lt;br /&gt;
| This idiom works for different data-types also.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:46&lt;br /&gt;
|So lets type a is equal to 2 point 5; then b within double quotes hello where h is small letter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:59&lt;br /&gt;
|Then a comma b is equal to b comma a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:09&lt;br /&gt;
|Then a; then b.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:13 &lt;br /&gt;
| Moreover this type of behaviour is something that feels natural and you'd expect to happen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:19&lt;br /&gt;
|This is possible because of the immutability of tuples. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:22&lt;br /&gt;
|This process is called tuple packing and unpacking.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:26&lt;br /&gt;
|So type 5 comma and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:37&lt;br /&gt;
|What we see in the tuple is 1 element.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:41&lt;br /&gt;
|So type 5 comma within double quotes hello where h is small letter comma 2.5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:57&lt;br /&gt;
|Now, It is a tuple with 3 elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:03&lt;br /&gt;
|So when we are actually typing  2 or more elements separated by comma the elements are packed into a tuple.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:10&lt;br /&gt;
|When we type a comma b is equal to b comma a first the value of b and a are packed into a tuple from the right side then unpack into the variables a and b.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:21&lt;br /&gt;
| Immutability of tuples ensure that values are not changed during the packing and unpacking.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:29&lt;br /&gt;
| So This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:35&lt;br /&gt;
|1. Define tuples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:36&lt;br /&gt;
|2. Understand the similarities of tuples with lists, like indexing and iterability.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:44&lt;br /&gt;
|3. Know about the immutability of tuples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:48&lt;br /&gt;
|4. Swap values, the python way.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:52&lt;br /&gt;
|5. Understand the concept of packing and unpacking tuples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:57&lt;br /&gt;
| Here are some self assessment questions for you to solve.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:01&lt;br /&gt;
|1. Define a tuple containing two values. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:04&lt;br /&gt;
|The first being integer 4 and second is a float 2.5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:08&lt;br /&gt;
|2. If &amp;lt;tt&amp;gt;a = 5,&amp;lt;/tt&amp;gt; then what is the type of a ?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:13&lt;br /&gt;
|The options are int , float, tuple, string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:19&lt;br /&gt;
|The final question the third one is if &amp;lt;tt&amp;gt;a = (2, 3)&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:25&lt;br /&gt;
| What does &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;a[0], a[1] = (3, 4)&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; produce.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:34&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:38&lt;br /&gt;
|1. A tuple is defined by enclosing parentheses around a sequence of items separated by commas. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:44&lt;br /&gt;
|Hence, we write our tuple as,within brackets 4 comma 2.5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:53&lt;br /&gt;
|2. Since the given data is 5 followed by a comma, it means that it is a tuple&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:01&lt;br /&gt;
|3. &amp;lt;nowiki&amp;gt;The operation a within square brackets 0, a within square brackets 1 is equal to within brackets 3 comma 4 will result in an error because tuples are immutable.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:14&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:17&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Manipulating-strings/English-timed</id>
		<title>Python/C3/Manipulating-strings/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Manipulating-strings/English-timed"/>
				<updated>2013-01-02T12:08:05Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hi and Welcome to this tutorial on 'manipulating strings'.  |- | 0:04 | At the end of this tutorial, you will be able to,  # Slice stri…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hi and Welcome to this tutorial on 'manipulating strings'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:04&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Slice strings and get sub-strings out of them.&lt;br /&gt;
# Reverse strings.&lt;br /&gt;
# Replace characters in strings.&lt;br /&gt;
# Convert strings to upper or lower case.&lt;br /&gt;
# Join a list of strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:19&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;getting started with strings&amp;quot;, &amp;quot;getting started with lists&amp;quot; and &amp;quot;basic datatypes and operators&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:31&lt;br /&gt;
| Let us invoke our ipython interpreter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:34&lt;br /&gt;
|So type ipython in the command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:39&lt;br /&gt;
| Let us consider a simple problem, and learn how to slice strings and get sub-strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:46&lt;br /&gt;
|Let's say the variable &amp;lt;tt&amp;gt;week&amp;lt;/tt&amp;gt; has the list of the names of the days of the week.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:52&lt;br /&gt;
|that is week is equal to within square brackets in double quotes sunday sun then comma mon for monday ,then tuesday so tue,then wednesday thursday, friday and saturday.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:15&lt;br /&gt;
|Let us consider a simple problem.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:18&lt;br /&gt;
|So now given a string &amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt;, we should be able to check if the string is a valid name of a day of the week or not. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:29&lt;br /&gt;
|Let us define our string as saturday&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:32&lt;br /&gt;
| So type in double quotes saturday &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|s is equal to saturday&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:41&lt;br /&gt;
|s could be in any of the form&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:46&lt;br /&gt;
|that is sat saturday, then s captial a t then capital s saturday then sat centre letter in capital then whole saturday in capital letters&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:05&lt;br /&gt;
|For now, we shall be solving the problem only for the forms,small sat and small saturday.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:16&lt;br /&gt;
| We shall solve it for the other forms, at the end of the tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:23&lt;br /&gt;
| So, we need to check if the first three characters of the given string exists in the variable &amp;lt;tt&amp;gt;week&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:31&lt;br /&gt;
|As with any of the sequence data-types, strings can be sliced into sub-strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:37&lt;br /&gt;
| To get the first three characters of s, we say,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:41&lt;br /&gt;
|s in closing brackets, square brackets 0 colon 3 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:48&lt;br /&gt;
| Note that, we are slicing the string from the index 0 to index 3, 3 not included.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:55&lt;br /&gt;
|As we already know, the last element of the string can be accessed using &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;s within brackets -1.&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:02&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:09&lt;br /&gt;
| '''Obtain the sub-string excluding the first and last characters''' from the string s.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:16&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:18&lt;br /&gt;
|Type s in square brackets 1 colon -1 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:30 &lt;br /&gt;
| We get the substring of s, without the first and the last characters of s.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:37&lt;br /&gt;
|Now let us check if a particular substring is present in the variable &amp;lt;tt&amp;gt;week&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:41&lt;br /&gt;
|We shall check for 'sat'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:46&lt;br /&gt;
|So type s in square brackets colon 3 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:52&lt;br /&gt;
|then s colon 3 in week&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:09&lt;br /&gt;
| We get the result as true.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:11&lt;br /&gt;
| Let us now consider the problem of finding out, if a given string is palindromic or not.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:18&lt;br /&gt;
| First of all, a palindromic string is a string that remains same even when it has been reversed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:26&lt;br /&gt;
|Let the string given be &amp;lt;tt&amp;gt;malayalam&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:30&lt;br /&gt;
|So s1 is equal to malayalam&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:35&lt;br /&gt;
|So malayalam should be in double quotes.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:40&lt;br /&gt;
| Now, we need to compare this string with it's reverse.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:45&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;Again, we will use a technique common to all sequence data-types, that is, within square brackets colon colon -1.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:55&lt;br /&gt;
|So, we obtain the reverse of s, by simply saying,s1 and within square brackets colon colon -1 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:06&lt;br /&gt;
| Now, to check if the string is &amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt; is palindromic, we say s1 is equal to is equal to s1 in square brackets colon colon -1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:23&lt;br /&gt;
| As, expected, we get &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:26&lt;br /&gt;
|Now, if the string we are given is &amp;lt;tt&amp;gt;Malayalam&amp;lt;/tt&amp;gt; instead of &amp;lt;tt&amp;gt;malayalam&amp;lt;/tt&amp;gt;, the above comparison would return a False. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:36&lt;br /&gt;
|So, we will have to convert the string to a lower case or to all upper case, before comparing. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:43&lt;br /&gt;
|Python provides methods, &amp;lt;tt&amp;gt;s dot lower&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;s dot upper&amp;lt;/tt&amp;gt; to achieve this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:48&lt;br /&gt;
|Let's try it out.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:51&lt;br /&gt;
|So type s1 is equal to malayalam in double quotes where m is capital.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:03&lt;br /&gt;
|then s1 dot upper then closing brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:10&lt;br /&gt;
|then s1 will give u the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:14&lt;br /&gt;
|okay. So as you can see, s has not changed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:18&lt;br /&gt;
| It is because, &amp;lt;tt&amp;gt;upper&amp;lt;/tt&amp;gt; returns a new string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:20&lt;br /&gt;
|It doesn't change the original string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:22&lt;br /&gt;
|Similarly, type s1 dot lower closing brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:32&lt;br /&gt;
|Then s1 dot lower closing brackets is equal to is equal to&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:40&lt;br /&gt;
|s1 dot lower closing brackets within square bracket colon colon -1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:51&lt;br /&gt;
| So pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:57&lt;br /&gt;
| '''Check if &amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt; is a valid name of a day of the week.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:02&lt;br /&gt;
| Change the''' solution to this problem, to include forms like, SAT, SATURDAY, Saturday and Sat.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:19&lt;br /&gt;
| Switch to your terminal for solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:22&lt;br /&gt;
|Type s in week. Then s dot lower closing bracket&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:33&lt;br /&gt;
|then in square brackets colon 3&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:37&lt;br /&gt;
|then in week&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:43 &lt;br /&gt;
| So, as you can see, now we can check for presence of &amp;lt;tt&amp;gt;s&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;week&amp;lt;/tt&amp;gt;, in whichever format it is present -- capitalized, or all caps, full name or short form.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:56&lt;br /&gt;
|We just convert any input string to lower case and then check if it is present in the list &amp;lt;tt&amp;gt;week&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:03&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;Now, let us consider another problem.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:05&lt;br /&gt;
| We often encounter e-mail id's which have '@' and periods replaced with text, something like info[at]fossee[dot]in.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:26&lt;br /&gt;
| We now wish to get back proper e-mail addresses.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:30&lt;br /&gt;
|Let's say the variable email has the email address.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:34&lt;br /&gt;
|So type email is equal to &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:38&lt;br /&gt;
|within quotes double quotes info in square brackets at then fossee then again square bracket foss then dot then in.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:48&lt;br /&gt;
| Now, we first replace the &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[at]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; with the &amp;lt;tt&amp;gt;@&amp;lt;/tt&amp;gt;, using the replace method of strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:57&lt;br /&gt;
|so type email is equal to email.replace&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:05&lt;br /&gt;
|then in brackets double quotes @ at square brackets comma then again in square bracket&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:14&lt;br /&gt;
|Now, type print email to get the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:22&lt;br /&gt;
| So pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:30&lt;br /&gt;
| Replace the &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[dot]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; in &amp;lt;tt&amp;gt;email&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:38&lt;br /&gt;
| Switch to the terminal for solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:43&lt;br /&gt;
|Type email is equal to email.replace within brackets in double quotes dot square brackets &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:02&lt;br /&gt;
|then again in double quotes a dot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:07&lt;br /&gt;
| Now, let us look at another interesting problem where we have a list of e-mail addresses and we wish to obtain one long string of e-mail addresses separated by commas or semi-colons.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:23&lt;br /&gt;
|So type email underscore list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:30&lt;br /&gt;
|is equal to within square brackets double quotes info at the rate fossee dot in, enquiries at the rate fossee dot in,then again comma in double quotes help at the rate fossee dot in&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:42&lt;br /&gt;
| Now, if we wish to obtain one long string, separating each of the email id by a comma, we use the join operation on email_str is equal to in double quotes comma&lt;br /&gt;
 dot join then in brackets email underscore list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:13&lt;br /&gt;
|then hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:15&lt;br /&gt;
|then print email underscore str for output. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:22&lt;br /&gt;
|so type print email underscore str&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:28&lt;br /&gt;
| So now, notice that the email ids are joined by a comma followed by a space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:34&lt;br /&gt;
|So now pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:41 &lt;br /&gt;
|For the email underscore str that we generated, change the separator to be a semicolon instead of a comma.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:51&lt;br /&gt;
| Then for that now switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:56&lt;br /&gt;
|Type email underscore str is equal to email underscore str dot replace then in brackets in double quotes comma then in another double quotes semicolon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:14&lt;br /&gt;
|Then type print email underscore str.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:26&lt;br /&gt;
| We see that the email ids are joined by a semicolon followed by a space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:32&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:35&lt;br /&gt;
| In this tutorial, we have learnt to, Obtain sub-strings and reverse of strings by using the index numbers&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:41&lt;br /&gt;
|2. Use following functions - - &amp;lt;tt&amp;gt;upper()&amp;lt;/tt&amp;gt; -- to obtain the upper case of a string - &amp;lt;tt&amp;gt;lower()&amp;lt;/tt&amp;gt; -- to obtain the lower case of a string - &amp;lt;tt&amp;gt;replace()&amp;lt;/tt&amp;gt; -- to replace a character by another one - &amp;lt;tt&amp;gt;join()&amp;lt;/tt&amp;gt; -- to join a list of strings with an operator&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:57&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:01&lt;br /&gt;
|1. Given a string &amp;lt;tt&amp;gt;s = &amp;quot;this is a string&amp;quot;&amp;lt;/tt&amp;gt;, how will you change it to &amp;lt;tt&amp;gt;&amp;quot;this isn't a list&amp;quot;&amp;lt;/tt&amp;gt; ?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:09&lt;br /&gt;
| Given the string &amp;quot;F.R.I.E.N.D.S&amp;quot; in s, obtain the string &amp;quot;friends&amp;quot; where the friends in s is all capital letters separated by dots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:26&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:28&lt;br /&gt;
|1. We will use the &amp;lt;tt&amp;gt;replace&amp;lt;/tt&amp;gt; function to accomplish this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:31&lt;br /&gt;
| so type s = s dot replace within brackets and double quotes string,again brackets and double quotes list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:40&lt;br /&gt;
| then s = s dot replace within brackets  and double quotes is, again brackets and double quotes isn't&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:51&lt;br /&gt;
| We notice that every 'is' in the statement has been replaced by &amp;lt;tt&amp;gt;isn't&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:59&lt;br /&gt;
|2. In order to change the string to lower case, we use the method &amp;lt;tt&amp;gt;lower()&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:05&lt;br /&gt;
|So type s in square brackets colon colon 2 dot lower closing brackets.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:13&lt;br /&gt;
|So we hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:16&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Manipulating-lists/English-timed</id>
		<title>Python/C3/Manipulating-lists/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Manipulating-lists/English-timed"/>
				<updated>2013-01-02T12:06:56Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and Welcome to the tutorial on 'Manipulating Lists'.  |- | 0:05 | At the end of this tutorial, you will be able to,  # Co…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and Welcome to the tutorial on 'Manipulating Lists'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Concatenate two lists&lt;br /&gt;
# Learn the details of slicing and striding of lists&lt;br /&gt;
# Sort and reverse lists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:17 &lt;br /&gt;
| So, before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Lists&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:24&lt;br /&gt;
| So let's start ipython on our terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:28&lt;br /&gt;
|Type ipython and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:35&lt;br /&gt;
| We have already learnt about lists in Python, how to access individual elements in the list and some of the functions that can be run on the lists like &amp;lt;tt&amp;gt;max, min, sum, len&amp;lt;/tt&amp;gt; and so on. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:48&lt;br /&gt;
| Now let us learn some of the basic operations that can be performed on Lists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:54&lt;br /&gt;
|We already know how to access individual elements in a List.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:57&lt;br /&gt;
| But what if we have a scenario where we need to get a part of the entir e list or what we call as a slice of the list?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:07&lt;br /&gt;
| Python supports slicing on lists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:10&lt;br /&gt;
| Let us say I have the list, primes equal within bracket 2,3,5,7,11,13,17,19,23,29.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:33 &lt;br /&gt;
|Hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:35&lt;br /&gt;
| To obtain all the primes between 10 and 20 from the above list of primes we say primes[4:8] &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:51&lt;br /&gt;
| This gives us all the elements in the list starting from the element with the index 4, which is 11, upto the element with index 8 in the list but not including the eighth element. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:04&lt;br /&gt;
|So we obtain a slice starting from 11 upto 19th.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:08&lt;br /&gt;
| It is very important to remember that whenever we specify a range of elements in Python, the start index is included and end index is not included.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:18&lt;br /&gt;
| So in the above case, 11, which is element with the index 4, was included but 23 which was the element with index 8 was excluded.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:29&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2;36&lt;br /&gt;
| Obtain the primes less than 10, from the list &amp;lt;tt&amp;gt;primes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:45&lt;br /&gt;
| So now switch to terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:47&lt;br /&gt;
|Type primes within brackets 0 colon 4 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:57&lt;br /&gt;
| It give us the primes below 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:00&lt;br /&gt;
| Generalizing, we can obtain a slice of the list &amp;quot;p&amp;quot; from the index &amp;quot;start&amp;quot; upto the index &amp;quot;end&amp;quot; but excluding &amp;quot;end&amp;quot; with the syntax &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;p[start:stop]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:17&lt;br /&gt;
| So by default the slice fetches all the elements between start and stop including start but not stop. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:24&lt;br /&gt;
|So as to say we obtain all the elements between start and stop in steps of one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:31&lt;br /&gt;
| Python also provides us the functionality to specify the steps in which the slice must be obtained.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:37&lt;br /&gt;
| So we have num is equal to within brackets 0,1,2,3,4,5,6,7,8,9,10,11,12,13.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:59&lt;br /&gt;
| If we want to obtain all the odd numbers less than 10 from the list &amp;lt;tt&amp;gt;num&amp;lt;/tt&amp;gt; we have to start from element with index 1 upto the index 10 in steps of 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:12&lt;br /&gt;
|So we type num within square brackets 1 is to 10 is to 2 that is ,1 colon 10 colon 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:24&lt;br /&gt;
| When no step is specified, it is assumed to be 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:28&lt;br /&gt;
| Similarly, there are default values for start and stop indices as well.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:34&lt;br /&gt;
| If we don't specify the start index, it is implicitly taken as the first element of the list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:46&lt;br /&gt;
|So type num within square brackets colon 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:52&lt;br /&gt;
| This gives us all the elements from the beginning upto the 10th element but not including the 10th element in the list. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:59&lt;br /&gt;
|Similarly if the stop index is not specified, it is implicitly assumed to be the end of the list, including the last element of the list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:10&lt;br /&gt;
|So type num within square brackets 10 colon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:21&lt;br /&gt;
| This gives us all elements starting from the 10th element in the list &amp;quot;num&amp;quot; upto the final element including the last element.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:30&lt;br /&gt;
|To get all the even numbers in the list &amp;quot;num&amp;quot;, we do num in square brackets colon colon 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:42&lt;br /&gt;
| So now pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:48&lt;br /&gt;
| Obtain all the multiples of three from the list &amp;lt;tt&amp;gt;num&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:56 &lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:59&lt;br /&gt;
|&amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;num colon colon 3&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; gives us all the multiples of 3 from the list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:05&lt;br /&gt;
| Since every third element in this starting from zero is divisible by 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:14&lt;br /&gt;
| The other basic operation that we can perform on lists is concatenation of two or more lists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:22&lt;br /&gt;
| We can combine two lists by using the &amp;quot;plus&amp;quot; operator. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:26&lt;br /&gt;
|Say we have a is equal to within square brackets 1,2,3,4, b is equal to within square brackets 4,5,6,7&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:42&lt;br /&gt;
|Then type a plus b and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:47&lt;br /&gt;
| When we concatenate lists using the &amp;quot;plus&amp;quot; operator we get a new list. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:52&lt;br /&gt;
|We can store this list in a new variable,say c,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:58&lt;br /&gt;
|So c is equal to a plus b.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:01&lt;br /&gt;
|Then type c.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:06&lt;br /&gt;
| It is important to observe that the &amp;quot;plus&amp;quot; operator always returns a new list without altering the lists being concatenated in any way.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:13&lt;br /&gt;
|We know that a list is a collection of data. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:16&lt;br /&gt;
|Whenever we have a collection, we run into situations where we want to sort the collection.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:22&lt;br /&gt;
| Lists support &amp;lt;tt&amp;gt;sort&amp;lt;/tt&amp;gt; method which sorts the list in place&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:28&lt;br /&gt;
|So type a is equal to 5,1,6,7,7,10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:40&lt;br /&gt;
|Then type a dot sort and closing brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:46&lt;br /&gt;
| Now the contents of the list &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; will be&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:50&lt;br /&gt;
|Type a and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:52&lt;br /&gt;
| As the &amp;lt;tt&amp;gt;sort&amp;lt;/tt&amp;gt; method sorts the elements of a list, the original list we had, is overwritten or replaced.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:00&lt;br /&gt;
| We have no way to obtain the original list back.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:03&lt;br /&gt;
| One way to avoid this is to keep a copy of the original list in another variable and run the sort method on the list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:10&lt;br /&gt;
| However Python also provides a built-in function called sorted which sorts the list which is passed as an argument to it and returns a new sorted list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:20&lt;br /&gt;
| We can store this sorted list into another list variable&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:26&lt;br /&gt;
|so type a is equal to  5,1 6,7,7,10 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:39&lt;br /&gt;
|then type sorted within brackets a, enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:47 &lt;br /&gt;
|Now,as we said we can store the sorted list into another list variable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:52&lt;br /&gt;
|So type sa is equal to sorted within brackets a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:59&lt;br /&gt;
| Python also provides the &amp;lt;tt&amp;gt;reverse&amp;lt;/tt&amp;gt; method which reverses the list in place&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:03&lt;br /&gt;
|so type a is equal to brackets 1,2,3,4,5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
|a dot reverse within closing brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:16 &lt;br /&gt;
| the &amp;lt;tt&amp;gt;reverse&amp;lt;/tt&amp;gt; method reverses the list &amp;quot;a&amp;quot; and stores the reversed list in place i.e. in &amp;quot;a&amp;quot; itself. Lets see the list &amp;quot;a&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:27&lt;br /&gt;
|So type a and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:30&lt;br /&gt;
| But again the original list is lost.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:32 &lt;br /&gt;
|To reverse a list, we could use striding with negative indexing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:37&lt;br /&gt;
|So type a within square brackets colon colon -1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:45&lt;br /&gt;
| We can also store this new reversed list in another list variable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:49  &lt;br /&gt;
|Pause the video here, and try out the exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:54&lt;br /&gt;
| '''Given a list of marks of students in an examination, obtain a list with marks in descending order.'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:01&lt;br /&gt;
|marks are 99, 67, 47, 100, 50, 75, 62.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:09&lt;br /&gt;
| So now switch to terminal &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:17&lt;br /&gt;
| and type marks is equal to within square brackets 99,67,47,100,50,75,62.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:36&lt;br /&gt;
|Now, in terminal type sorted within brackets marks then in square brackets colon colon minus 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:54&lt;br /&gt;
|Then or you can use another method&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:57&lt;br /&gt;
|So sorted within brackets marks comma reverse is equal to True.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:08&lt;br /&gt;
| So this brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:11&lt;br /&gt;
| In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:14&lt;br /&gt;
| obtain parts of lists using slicing and striding.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:17&lt;br /&gt;
| Concatenate lists using the &amp;lt;tt&amp;gt;plus&amp;lt;/tt&amp;gt; operator. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:20&lt;br /&gt;
|3. Sort lists using the &amp;lt;tt&amp;gt;sort&amp;lt;/tt&amp;gt; method.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:22&lt;br /&gt;
|4. Use the method &amp;lt;tt&amp;gt;reverse&amp;lt;/tt&amp;gt; to reverse the lists.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:26&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:30&lt;br /&gt;
|1. Given the list primes, &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;primes is equal to 1, 3, 5, 7, 11, 13, 17, 19, 23, 29 &amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;, How do you obtain the last 4 primes?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:41&lt;br /&gt;
|2. Given a list, p, of unknown length, obtain the first 3 (or all, if there are fewer) characteristics of it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:53&lt;br /&gt;
|3.&amp;lt;tt&amp;gt;reversed&amp;lt;/tt&amp;gt; function reverses a list in place. True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:58&lt;br /&gt;
| Let us look at the answers&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:03&lt;br /&gt;
| And the answers are&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:05&lt;br /&gt;
|1. The last four primes can be obtained from the given list as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:09&lt;br /&gt;
| primes within brackets -4 colon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:14&lt;br /&gt;
|and 2. The first 3 characters can be obtained as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:20&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;p within square brackets colon 3.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:24&lt;br /&gt;
|and the third and the final question the answer is False.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:28&lt;br /&gt;
| The function &amp;lt;tt&amp;gt;reverse&amp;lt;/tt&amp;gt; will reverse a list in place.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:32&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:35&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Loops/English-timed</id>
		<title>Python/C3/Loops/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Loops/English-timed"/>
				<updated>2013-01-02T12:06:13Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello Friends and Welcome to the tutorial on 'loops' in Python.  |- | 0:05 | At the end of this tutorial, you will be able to,  # u…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello Friends and Welcome to the tutorial on 'loops' in Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# use the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop&lt;br /&gt;
# use the &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;break&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;pass&amp;lt;/tt&amp;gt; statements to play around with loops.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:17&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with for&amp;quot; and &amp;quot;Conditionals&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:24&lt;br /&gt;
| Let us start our ipython interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:28&lt;br /&gt;
|Type ipython in the terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:32&lt;br /&gt;
| We shall first begin with the &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:34&lt;br /&gt;
| The &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop is used for repeated execution as long as a condition is &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:39&lt;br /&gt;
| Let us print the squares of all the odd numbers less than 10, using the &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:45&lt;br /&gt;
|Type i = 1&lt;br /&gt;
&lt;br /&gt;
 while i less than 10 colon&lt;br /&gt;
     print i multiply by i&lt;br /&gt;
     i += 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:19&lt;br /&gt;
| This loop prints the squares of the odd numbers below 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:23&lt;br /&gt;
| The &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop, repeatedly checks if the condition is true and executes the block of code within the loop, if it is. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:30&lt;br /&gt;
| As with any other block in Python, the code within the &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; block is indented to the right by 4 spaces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:41&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:48&lt;br /&gt;
| '''Write a &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop to print the squares of all the even''' numbers below 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:55&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:58&lt;br /&gt;
|Type i = 2&lt;br /&gt;
&lt;br /&gt;
 while i less than 10 colon&lt;br /&gt;
     print i multiply by i&lt;br /&gt;
     i += 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:27&lt;br /&gt;
| Let us now solve the same problem of printing the squares of all odd numbers less than 10, using the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:34&lt;br /&gt;
| As we know, the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop iterates over a list or any other sequential data type. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:40&lt;br /&gt;
| So, we use the &amp;lt;tt&amp;gt;range&amp;lt;/tt&amp;gt; function to get a list of odd numbers below 10, and then iterate over it and print the required stuff.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:48&lt;br /&gt;
|Type for n in range within bracket 1 comma 10 comma 2 colon&lt;br /&gt;
       print n multiply by n&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:07&lt;br /&gt;
| We can see that we got the same output as before. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:10&lt;br /&gt;
| Note that the lines of code are less.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:13&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:19&lt;br /&gt;
| '''Write a &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop to print the squares of all the even''' numbers below 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:24&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:26&lt;br /&gt;
|Type for n in range within bracket 2 comma 10 comma 2 colon&lt;br /&gt;
         print n multiply by n&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:46&lt;br /&gt;
| Let us now look at how to use the keywords, &amp;lt;tt&amp;gt;pass&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;break&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:52&lt;br /&gt;
| As we already know, &amp;lt;tt&amp;gt;pass&amp;lt;/tt&amp;gt; is just a syntactic filler. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:56&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;
|4:02&lt;br /&gt;
|Type for n in range within bracket 2 comma 10 comma 2 colon&lt;br /&gt;
&lt;br /&gt;
    pass&lt;br /&gt;
&lt;br /&gt;
    And Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:20&lt;br /&gt;
| &amp;lt;tt&amp;gt;break&amp;lt;/tt&amp;gt; is used to break out of the innermost loop. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:24&lt;br /&gt;
| The &amp;lt;tt&amp;gt;while&amp;lt;/tt&amp;gt; loop to print the squares of all the odd numbers below 10, can be modified using the &amp;lt;tt&amp;gt;break&amp;lt;/tt&amp;gt; statement, as follows&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:31&lt;br /&gt;
|Type = 1&lt;br /&gt;
&lt;br /&gt;
while True colon&lt;br /&gt;
    print i multiply by i&lt;br /&gt;
    i += 2&lt;br /&gt;
    if i is less than 10 colon&lt;br /&gt;
    break&lt;br /&gt;
|-&lt;br /&gt;
|5:10&lt;br /&gt;
|So we got a syntax error because 'if' is not inside the while loop&lt;br /&gt;
 So type while True colon&lt;br /&gt;
    	print i multiply by i&lt;br /&gt;
    	i += 2&lt;br /&gt;
    	if i less than 10 colon&lt;br /&gt;
        break&lt;br /&gt;
Make sure that 'if' is inside the while loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:42&lt;br /&gt;
| &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt; is used to skip execution of the rest of the loop on this iteration and continue to the end of this iteration.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:50&lt;br /&gt;
| So, we wish to print the squares of all the odd numbers below 10, which are not multiples of 3, we would modify the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop as follows.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:03&lt;br /&gt;
|So, in terminal, Type for n in range within bracket 1 comma 10 comma 2 colon&lt;br /&gt;
&lt;br /&gt;
    if n modulo 3 == 0 colon&lt;br /&gt;
        continue&lt;br /&gt;
    print n multiply by n&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:36&lt;br /&gt;
| Now Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:41&lt;br /&gt;
| Using the &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt; keyword modify the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop, with the &amp;lt;tt&amp;gt;range(2 comma 10 comma 2)&amp;lt;/tt&amp;gt;, to print the squares of even numbers below 10, which are multiples of 4.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:53&lt;br /&gt;
|  (Do not modify the range function call.)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:59&lt;br /&gt;
| Now  Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:02&lt;br /&gt;
|Type for n in range within bracket 2 comma 10 comma 2 colon&lt;br /&gt;
    if n modulo 4 colon&lt;br /&gt;
        continue&lt;br /&gt;
    print n multiply by n&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:30&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:33&lt;br /&gt;
|  In this tutorial, we have learnt to, 1. Iterate over a sequence using ``for'' and ``while'' loops.&lt;br /&gt;
  &lt;br /&gt;
|-&lt;br /&gt;
|  7:38&lt;br /&gt;
| 2. Break out of loops using ``break'' statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:42&lt;br /&gt;
| 3. Skip iterations using ``continue'' statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:45&lt;br /&gt;
| 4. Use the ``pass'' statement in a loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:49&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:52&lt;br /&gt;
| 1. Given &amp;lt;tt&amp;gt;range(1 comma 4)&amp;lt;/tt&amp;gt;&amp;lt;nowiki&amp;gt;; Write a code to print only the number 1.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:01&lt;br /&gt;
| 2.Second one is, Which statement do you use to skip iterations. - break - pass - continue&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:10&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:12&lt;br /&gt;
| 1. First one, We can use the break statement in a for loop as,&lt;br /&gt;
''' colon colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:21&lt;br /&gt;
| '''for i in range within bracket 1 comma 4 colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:27&lt;br /&gt;
| Then print i break&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
|  8:30&lt;br /&gt;
|  And second one, In order to skip iterations,we make use of the &amp;lt;tt&amp;gt;continue&amp;lt;/tt&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:37&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Conditionals/English-timed</id>
		<title>Python/C3/Conditionals/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Conditionals/English-timed"/>
				<updated>2013-01-02T12:05:19Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and Welcome to the tutorial on 'Conditionals'.  |- | 0:05  | At the end of this tutorial, you will be able to,  # Use…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and Welcome to the tutorial on 'Conditionals'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05 &lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Use if/else blocks.&lt;br /&gt;
# Use if/elif/else blocks.&lt;br /&gt;
# Use the Ternary conditional statement - C if X else Y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:25&lt;br /&gt;
| To begin with let us start ipython,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:29&lt;br /&gt;
|So type ipython in the terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:36&lt;br /&gt;
| Whenever we have two possible states that can occur depending on a a certain condition, we can use if/else construct in Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:45&lt;br /&gt;
| For example, say, we have a variable &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; which stores integers and we are required to find out whether &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is even or odd. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:52&lt;br /&gt;
| Let's say the value of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is 5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:55&lt;br /&gt;
|So type a=5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:59&lt;br /&gt;
| In such a case we can write the if/else block as&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:04&lt;br /&gt;
|In command line if a percentage 2 == 0 colon&lt;br /&gt;
&lt;br /&gt;
    		print in double quotes Even&lt;br /&gt;
	   else colon&lt;br /&gt;
    		print in double quotes Odd&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:37&lt;br /&gt;
| If &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is divisible by 2, i.e., the result of &amp;quot;a modulo 2&amp;quot; is 0, it prints &amp;quot;Even&amp;quot;, otherwise it prints &amp;quot;Odd&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:51&lt;br /&gt;
| Note that in such a case, only one of the two blocks gets executed depending on whether the condition is &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt; or &amp;lt;tt&amp;gt;False&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:58&lt;br /&gt;
| There is a very important syntactic element to understand here. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:03&lt;br /&gt;
| Every code block begins with a line that ends with a &amp;lt;tt&amp;gt; colon&amp;lt;/tt&amp;gt;, in this example the &amp;lt;tt&amp;gt;if&amp;lt;/tt&amp;gt; and the &amp;lt;tt&amp;gt;else&amp;lt;/tt&amp;gt; lines. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:15&lt;br /&gt;
| Also, all the statements inside a code block are intended by 4 spaces. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:21&lt;br /&gt;
| Hitting enter twice, ends the code block.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
| The if/else blocks work for a condition, which can take one of two states. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:31&lt;br /&gt;
| But what do we do for conditions, which can take more than two states?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:38&lt;br /&gt;
| Python provides if/elif/else blocks, for such conditions. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:47&lt;br /&gt;
| For example. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:49&lt;br /&gt;
| We have a variable &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; which holds integer values. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:52&lt;br /&gt;
| We need to print &amp;quot;positive&amp;quot; if &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; is positive, &amp;quot;negative&amp;quot; if it is negative or &amp;quot;zero&amp;quot; if it is 0.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:04&lt;br /&gt;
| Let us use if/elif/else ladder for it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:09&lt;br /&gt;
| For the purposes of testing our code let us assume that the value of a is -3&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:16&lt;br /&gt;
|Type	a = -3&lt;br /&gt;
&lt;br /&gt;
	if a greater than 0 colon&lt;br /&gt;
	    print in double quotes positive&lt;br /&gt;
	elif a less than 0 colon&lt;br /&gt;
	    print in double quotes negative&lt;br /&gt;
	else colon&lt;br /&gt;
	    print in double quotes zero&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:17&lt;br /&gt;
| All the syntax and rules as said for if/else statements hold the same. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:24&lt;br /&gt;
| The only addition here is the &amp;lt;tt&amp;gt;elif&amp;lt;/tt&amp;gt; statement which can have another condition of its own.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:30&lt;br /&gt;
| Here too, exactly one block of code is executed -- the block of code which first evaluates to &amp;lt;tt&amp;gt;True&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:41&lt;br /&gt;
| Even if there is a situation where multiple conditions evaluate to True, all the subsequent conditions other than the first one, which evaluates to True, are neglected. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:51&lt;br /&gt;
| Consequently, the else block gets executed if and only if all the conditions evaluate to False.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:59&lt;br /&gt;
| Also, the &amp;lt;tt&amp;gt;else&amp;lt;/tt&amp;gt; block in both if/else statement and if/elif/else is optional. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:08&lt;br /&gt;
| We can have a single if statement or just if/elif statements without having else block at all. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:17&lt;br /&gt;
| Also, there can be any number of elif's within an if/elif/else ladder. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:26&lt;br /&gt;
| For example&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|Type 	if user == in single quotes admin colon&lt;br /&gt;
	elif user == in single quotes moderator colon&lt;br /&gt;
	elif user == in single quotes client colon &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:47&lt;br /&gt;
| Note that there are multiple elif blocks and there is no else block.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:53&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:57&lt;br /&gt;
| '''Given a number, num. Write an if else block to print num, as is,'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:05&lt;br /&gt;
| if it is divisible by 10, else print 10 into num.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:12&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:14&lt;br /&gt;
|	if num modulo 10 == 0 colon&lt;br /&gt;
	print num&lt;br /&gt;
      else colon&lt;br /&gt;
	print 10 star num &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:29&lt;br /&gt;
| In addition to these conditional statements, Python provides a very convenient ternary conditional operator. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:35&lt;br /&gt;
| Let us take the following example where we read the marks from a data file which is obtained as a string as we read a file. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:43&lt;br /&gt;
| The marks can be in the range of 0 to 100 or 'AA' if the student is absent. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:51&lt;br /&gt;
| In such a case, to obtain the marks as an integer, we can use the ternary conditional operator. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:58&lt;br /&gt;
| Let us say the string score is stored in score underscore str variable&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:05&lt;br /&gt;
|So type score underscore str = in single quotes AA &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:13&lt;br /&gt;
| Now let us use the ternary conditional operator&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:19&lt;br /&gt;
|Type score = int within bracket score underscore str if score underscore str exclamation = in single quotes AA else 0 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:54&lt;br /&gt;
| '''Given a number, num. Write a ternary operator to print num, as is,'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:01&lt;br /&gt;
| if it is divisible by 10, else print 10 star num.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:08&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:11&lt;br /&gt;
| print num if num modulo 10 == 0 else 10 star num&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:19&lt;br /&gt;
| Moving on, there are certain situations where we will have no operations or statements within a block of code. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:27&lt;br /&gt;
| For example, we have a code where we are waiting for the keyboard input. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:32&lt;br /&gt;
| If the user enters &amp;quot;c&amp;quot;, &amp;quot;d&amp;quot; or &amp;quot;x&amp;quot; as the input, we would perform some operation; nothing otherwise. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:42&lt;br /&gt;
| In such cases &amp;quot;pass&amp;quot; statement comes very handy&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:49&lt;br /&gt;
| '''a = raw underscore input Enter 'c' to calculate and exit, 'd' to display the existing'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:04&lt;br /&gt;
| results exit and 'x' to exit and any other key to continue &lt;br /&gt;
|-&lt;br /&gt;
| 9:12&lt;br /&gt;
| '''if a == in single quote c colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:18&lt;br /&gt;
| '''elif a == in single quote d colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:23&lt;br /&gt;
| '''elif a == in single quote x colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:29&lt;br /&gt;
| '''else colon'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:32&lt;br /&gt;
| pass&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:35&lt;br /&gt;
| In this case &amp;quot;pass&amp;quot; statement acts as a place holder for the block of code. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:41&lt;br /&gt;
| It is equivalent to a null operation. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:45&lt;br /&gt;
| It literally does nothing. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:46&lt;br /&gt;
| It can used as a place holder when the actual code implementation for a particular block of code is not known yet but has to be filled up later.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:56&lt;br /&gt;
| This brings us to the end of the tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:59&lt;br /&gt;
| In this tutorial, we have learnt to, 1. Understand the conditional statements in Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:04&lt;br /&gt;
| 2. Use if/else statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:06&lt;br /&gt;
| 3. Use if/elif/else statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:09&lt;br /&gt;
| 4. Apply the ternary conditional statement - C if X else Y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:14&lt;br /&gt;
| 5. Use &amp;quot;pass&amp;quot; statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:18&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:21&lt;br /&gt;
| 1. Use conditional statements for the following. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:23&lt;br /&gt;
| Given a variable &amp;lt;tt&amp;gt;time&amp;lt;/tt&amp;gt;, print &amp;lt;tt&amp;gt;Good Morning&amp;lt;/tt&amp;gt; if it is less than 12, otherwise print &amp;lt;tt&amp;gt;Hello&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:30&lt;br /&gt;
| 2. Convert the if else ladder below into a ternary conditional statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:39&lt;br /&gt;
| x = 20&lt;br /&gt;
  if x greater than 10 colon&lt;br /&gt;
   print x multiply by 100&lt;br /&gt;
  else colon&lt;br /&gt;
   print x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:48&lt;br /&gt;
| And now look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:52&lt;br /&gt;
| 1. We can use the if/else statements as&lt;br /&gt;
  &amp;lt;nowiki&amp;gt;if time less than 12 colon&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
   print in double quotes Good Morning&lt;br /&gt;
  else colon&lt;br /&gt;
   print in double quotes Hello&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:06&lt;br /&gt;
| 1. The if else ladder can be converted to a ternary conditional statement as&lt;br /&gt;
   print x multiply by 100 if x greater than 10 else x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:17&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:20&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/I-O/English-timed</id>
		<title>Python/C3/I-O/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/I-O/English-timed"/>
				<updated>2013-01-02T12:04:34Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:00 | Hello friends and welcome to this tutorial on 'Input/Output'.  |- | 0:05 | At the end of this tutorial,you will be able to,  # Prin…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to this tutorial on 'Input/Output'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial,you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Print some value.&lt;br /&gt;
# Print using modifiers.&lt;br /&gt;
# Take input from user.&lt;br /&gt;
# Display a prompt to the user before taking the input.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:20&lt;br /&gt;
| So type ipython on our terminal.&lt;br /&gt;
|-&lt;br /&gt;
| 0:26&lt;br /&gt;
| Type a = within double quotes This is a string&lt;br /&gt;
  Type a&lt;br /&gt;
  Type print a&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:45&lt;br /&gt;
| obviously, &amp;lt;tt&amp;gt;print a&amp;lt;/tt&amp;gt;, prints the value of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:52&lt;br /&gt;
| As you can see, even when you type just a, the value of a is shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:59&lt;br /&gt;
| But there is a difference.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:01&lt;br /&gt;
| Typing just &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; displays the content of &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt; whereas the statement &amp;lt;tt&amp;gt;print a&amp;lt;/tt&amp;gt; prints the string itself. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:08&lt;br /&gt;
| This difference becomes more evident when we use strings with newlines in them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:14&lt;br /&gt;
|Type b =  within double quotes A line backslash n New line and hit enter&lt;br /&gt;
 Type b&lt;br /&gt;
 Type print b&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:35 &lt;br /&gt;
| As you can see, just typing &amp;lt;tt&amp;gt;b&amp;lt;/tt&amp;gt; shows that b contains a newline character but While typing &amp;lt;tt&amp;gt;print b&amp;lt;/tt&amp;gt;,it prints the string and hence the newline.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:46&lt;br /&gt;
| Moreover when we type just &amp;lt;tt&amp;gt;a&amp;lt;/tt&amp;gt;, the value a is shown only in interactive mode and does not have any effect on the program while running it as a script.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:00&lt;br /&gt;
| We shall look at different ways of outputting the data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:04&lt;br /&gt;
| print statement in python supports string formatting. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:08&lt;br /&gt;
| Various arguments can be passed to print using modifiers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:12	&lt;br /&gt;
| type x = 1.5&lt;br /&gt;
       y = 2&lt;br /&gt;
       z = within double quotes red&lt;br /&gt;
       print   within double quotes x is modula 2 dot 1f comma  y is modula d comma  z is modula s then again a modula within brackets x comma y comma z&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:51&lt;br /&gt;
| As you can see, the values of x, y and z are substituted in place of the modifiers &amp;lt;tt&amp;gt;modula 2.1f&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;modula d&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;modula s&amp;lt;/tt&amp;gt; respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:03&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:08&lt;br /&gt;
| What happens when you do &amp;lt;tt&amp;gt;print  within double quotes x is modula d comma  y is modula f modula within brackets x comma  y&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:19&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:24&lt;br /&gt;
| Type print  within double quotes x is modula d comma  y is modula f modula within brackets x comma  y&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:50&lt;br /&gt;
| We see that the &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt; value of x and &amp;lt;tt&amp;gt;float&amp;lt;/tt&amp;gt; value of y are printed corresponding to the modifiers used in the print statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:58&lt;br /&gt;
| We have seen that &amp;lt;tt&amp;gt;print&amp;lt;/tt&amp;gt; statement prints a new line character everytime it is called. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:04&lt;br /&gt;
| This can be suppressed by using a &amp;quot; comma &amp;quot; at the end of the &amp;lt;tt&amp;gt;print&amp;lt;/tt&amp;gt; statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:13&lt;br /&gt;
| Let us see this by typing out following code on an editor as print underscore example.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:24&lt;br /&gt;
| So Type..&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:44&lt;br /&gt;
|print &amp;quot;Hello&amp;quot;&lt;br /&gt;
 print &amp;quot;World&amp;quot;&lt;br /&gt;
&lt;br /&gt;
 print &amp;quot;Hello&amp;quot; comma &lt;br /&gt;
 print &amp;quot;World&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:22&lt;br /&gt;
| Save the script as 'print underscore example.py' and run it using modula run  slash home slash fossee slash print underscore example.py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:34&lt;br /&gt;
| As we can see, the print statement when used with comma in the end, prints a space instead of a new line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:46&lt;br /&gt;
| Now we shall look at taking input from the user. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:06&lt;br /&gt;
| We will use the ~~raw underscore input~~ for this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:11&lt;br /&gt;
|So type ip = raw underscore input() &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:23&lt;br /&gt;
| The cursor is blinking indicating that it is waiting for input, so type something and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:32&lt;br /&gt;
|So you can type an input&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:35&lt;br /&gt;
| Now let us see what is the value of ip by typing it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:41&lt;br /&gt;
|So type ip and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:45&lt;br /&gt;
| We can see that it contains the string &amp;quot;an input&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:51&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:58&lt;br /&gt;
| You have an question&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:02&lt;br /&gt;
| Enter the number 5.6 as input and store it in a variable called c.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:11&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:15&lt;br /&gt;
| We have to use the raw underscore input command with variable c. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:19&lt;br /&gt;
|So type c = raw underscore input() and hit enter&lt;br /&gt;
 Put 5.6&lt;br /&gt;
 And again enter.&lt;br /&gt;
 Type c&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:36&lt;br /&gt;
| Now let us see the type of c.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:40&lt;br /&gt;
|Type type within brackets c&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:46&lt;br /&gt;
| We see that c is a string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:49&lt;br /&gt;
| This implies that anything you enter as input, it will be taken as a string no matter what you enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:55&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:59&lt;br /&gt;
| What happens when you do not enter anything and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:04&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:08&lt;br /&gt;
|  Type d = raw underscore input()&lt;br /&gt;
	&amp;lt;RET&amp;gt;&lt;br /&gt;
	d&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:28&lt;br /&gt;
| We see that when nothing is entered, an empty string is considered as input.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:32&lt;br /&gt;
| raw underscore input also can display a prompt to assist the user.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:37&lt;br /&gt;
|So type name = raw underscore input within brackets  within double quotes Please enter your name:  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:48&lt;br /&gt;
| It prints the string given as argument and then waits for the user input.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:54&lt;br /&gt;
| Let us do one more exercise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:56&lt;br /&gt;
|  Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:00&lt;br /&gt;
| How do you display a prompt and let the user enter input in next line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:09&lt;br /&gt;
| Switch to the terminal for solution. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:12&lt;br /&gt;
| The trick is to include a newline character at the end of the prompt string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:17&lt;br /&gt;
|Type ip = raw underscore input within brackets  within double quotes Please enter a number in the next line backslash n&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:28&lt;br /&gt;
| It prints the newline character and hence the user enters input in the next line&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:35&lt;br /&gt;
| This brings us to the end of the tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:39&lt;br /&gt;
| In this tutorial, we have learnt to,1. Use the print statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:42&lt;br /&gt;
| 2. Use the modifiers modula d, modula f, modula s in the print statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:47&lt;br /&gt;
| 3. Take input from user by using &amp;lt;tt&amp;gt;raw underscore input()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:55&lt;br /&gt;
| 4. Display a prompt to the user before taking the input by passing a string as an argument to &amp;lt;tt&amp;gt;raw underscore input&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:04&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:08&lt;br /&gt;
| 1. &amp;lt;tt&amp;gt;a = raw underscore input()&amp;lt;/tt&amp;gt; and user enters &amp;lt;tt&amp;gt;2.5&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:13&lt;br /&gt;
| What is the type of a?&lt;br /&gt;
** str&lt;br /&gt;
** int&lt;br /&gt;
** float&lt;br /&gt;
** char&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:20&lt;br /&gt;
| 2. &amp;lt;tt&amp;gt;'''a = 2&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;b = 4.5&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:27&lt;br /&gt;
| What does ``print &amp;quot;a is modula d and b is'''&amp;lt;br/&amp;gt; Inline literal start-string without end-string.&amp;lt;br/&amp;gt; modula 2.1f&amp;quot; modula within brackets b comma a`` print?&lt;br /&gt;
** a is 2 and b is 4.5&lt;br /&gt;
** a is 4 and b is 2&lt;br /&gt;
** a is 4 and b is 2.0&lt;br /&gt;
** a is 4.5 and b is 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:50&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:53&lt;br /&gt;
| 1.No matter what you enter, it will be taken as a string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:58&lt;br /&gt;
| Hence 2.5 is a string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:01&lt;br /&gt;
| 2. Since 'b' is called first, It will display integer value of 'a' because the modifier used is modula d. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:10&lt;br /&gt;
| Similarly, 'b' will get the float value of 'a' due to it's modifier modula 2.1f. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:18&lt;br /&gt;
| Hence 'a' will be 4 and 'b' 2.0 .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:24&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Basic-datatypes-and-operators/English-timed</id>
		<title>Python/C3/Basic-datatypes-and-operators/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Basic-datatypes-and-operators/English-timed"/>
				<updated>2013-01-02T12:03:24Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:00 | Hello friends and welcome to the tutorial on 'Basic Data types and operators' in Python.  |- | 0:07 | At the end of this tutorial, …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to the tutorial on 'Basic Data types and operators' in Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:07&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# '''Know the Datatypes in Python'''&lt;br /&gt;
** &lt;br /&gt;
*** Numbers&lt;br /&gt;
*** Boolean&lt;br /&gt;
*** Sequence&lt;br /&gt;
# '''Learn about the Operators in Python'''&lt;br /&gt;
** &lt;br /&gt;
*** Arithmetic Operators&lt;br /&gt;
*** Boolean Operators&lt;br /&gt;
# '''Know the Python Sequence Data types'''&lt;br /&gt;
** &lt;br /&gt;
*** list&lt;br /&gt;
*** string&lt;br /&gt;
*** tuple&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:28&lt;br /&gt;
| First we will explore python data structures in the domain of numbers. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:34&lt;br /&gt;
| There are three built-in data types in python to represent numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:38&lt;br /&gt;
| These are:&lt;br /&gt;
&lt;br /&gt;
* int&lt;br /&gt;
* float&lt;br /&gt;
* complex&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:43&lt;br /&gt;
| Let us first invoke our ipython interpreter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:48&lt;br /&gt;
|So type ipython in your command and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:52&lt;br /&gt;
| Lets first talk about int.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:54&lt;br /&gt;
|So type a=13&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:00&lt;br /&gt;
|Then type a and you can see the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:03&lt;br /&gt;
| Now, we have our first int variable a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:07&lt;br /&gt;
| If we now see&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:08&lt;br /&gt;
|Type command type within brackets a then we see the output int&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:17&lt;br /&gt;
| This means that 'a' is a type of int.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:22&lt;br /&gt;
| There are lot of functions associated with the int datatype, to manipulate it in different ways.&lt;br /&gt;
  &lt;br /&gt;
|-&lt;br /&gt;
| 1:30&lt;br /&gt;
| These can be explored by doing, a dot tab&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:40&lt;br /&gt;
| ''int'' datatype can hold integers of any size lets see this by an example.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:48&lt;br /&gt;
|So type b= couple of 9 or some data, then type b and you can see the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:02&lt;br /&gt;
| As you can see, even when we put a value of 9 repeated 20 times, python did not complain.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:12&lt;br /&gt;
| This is because python's int data-type can hold integers of any size.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:17&lt;br /&gt;
|Let us now look at the float data-type.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:21&lt;br /&gt;
| Decimal numbers in python are represented by the float data-type&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
|So type p = 3 point 141592,then type p.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:41&lt;br /&gt;
| Then if you notice the value of output of &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt; isn't exactly equal to &amp;lt;tt&amp;gt;p&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:48&lt;br /&gt;
| This is because computer saves floating point values in a specific format.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:54&lt;br /&gt;
| There is always an approximation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:57&lt;br /&gt;
| This is why we should never rely on equality of floating point numbers in a program.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:05&lt;br /&gt;
| The last data type in the list is complex number&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:09&lt;br /&gt;
|So type c = 3 point 2 plus 4 point 6j &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:18&lt;br /&gt;
| it's just a combination of two floats the imaginary part being defined by j notation instead of i.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:25&lt;br /&gt;
| Complex numbers have a lot of functions specific to them. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:29&lt;br /&gt;
| Let us look at these&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:31&lt;br /&gt;
|So type c dot tab, so can get the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:37&lt;br /&gt;
| So let's try some of them c.real then c.imag&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
| 3:49&lt;br /&gt;
| c.real gives the real part of the number and c.imag the imaginary.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:56&lt;br /&gt;
| We can get the absolute value using the function abs within bracket c&lt;br /&gt;
|-&lt;br /&gt;
| 4:06&lt;br /&gt;
|Now pause the video here, and try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:15&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;Find the absolute value of 3+4j &amp;lt;pause&amp;gt; Switch to terminal for solution&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:27&lt;br /&gt;
|So type abs within bracket 3+4j&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:34&lt;br /&gt;
| Thus we get the absolute value of the expression.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:37&lt;br /&gt;
| Let us do 1 more exercise of a similar type.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:39&lt;br /&gt;
| Pause the video here, and try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:45&lt;br /&gt;
| What is the datatype of number 29 that is a couple of 999999999999999999? after 20 So Is it not int?&lt;br /&gt;
&lt;br /&gt;
|- &lt;br /&gt;
| 5:00&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:02&lt;br /&gt;
| The data type of this number is long though it is an integer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:07&lt;br /&gt;
| But big integers are internally stored in python as Long datatype.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:13&lt;br /&gt;
| Python also has Boolean as a built-in type.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:18&lt;br /&gt;
| To Try it out, just type in the terminal t=True.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:28&lt;br /&gt;
| note that T in true is capitalized.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:34&lt;br /&gt;
| You can apply different Boolean operations on t now for example&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:40&lt;br /&gt;
|Try out f = not t enter&lt;br /&gt;
f&lt;br /&gt;
f or t&lt;br /&gt;
f and t&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:59&lt;br /&gt;
| The results are self explanatory.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:01&lt;br /&gt;
| What if you want to apply one operator before another. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:05&lt;br /&gt;
| Well you can use parenthesis for precedence.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:10&lt;br /&gt;
| Lets write some piece of code to check this out.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:13&lt;br /&gt;
|So type a =False&lt;br /&gt;
b=True&lt;br /&gt;
c=True&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:24&lt;br /&gt;
| To check how precedence changes with parenthesis, we will try two expressions and their evaluation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:33&lt;br /&gt;
| The first one within bracket a and b or c and hit enter &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:44&lt;br /&gt;
| This expression gives the value True where as the expression a and within brackets b or c &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:01&lt;br /&gt;
| and that gives the value False.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:04&lt;br /&gt;
| Let's now look at some operators available in Python to manipulate these data types.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:09&lt;br /&gt;
| Python uses 'plus' sign for addition&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:13&lt;br /&gt;
|So type 23 + 74 you can see the added value&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:19&lt;br /&gt;
| And 'minus' sign for subtraction&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:24&lt;br /&gt;
|23 - 56 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:27&lt;br /&gt;
| '*' (star) sign for multiplication&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:33&lt;br /&gt;
| '/'(back slash) for division&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:37&lt;br /&gt;
|For example we can try out 384 by 16&lt;br /&gt;
8 by 3 &lt;br /&gt;
and for the decimal one we can try 8 point 0 by 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:57&lt;br /&gt;
| Note that, when we did 8/3 the first case results in an integer output as both the operands are integer however when 8 point 0/3 is used the answer is float as one of the operands is float.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:16 &lt;br /&gt;
| Let us move ahead with the operators. '%' (percentage) sign for modulo operation&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:23&lt;br /&gt;
|So type 87 modulo 6 and hit enter &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:29&lt;br /&gt;
| and two stars for a exponent.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:32&lt;br /&gt;
|So type 7 star star 8 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:38&lt;br /&gt;
| It is said one wishes to use the current value of variable in which the result is stored in the expression, one can do that by putting the operator before ''equal to''.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:49&lt;br /&gt;
|So you can say a=73&lt;br /&gt;
a star=34&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:59&lt;br /&gt;
| The above expression is same as, you can try out by typing a=a star 34 and hit enter &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:12&lt;br /&gt;
| and a backslash =23 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:21&lt;br /&gt;
| Pause the video here, and try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:25&lt;br /&gt;
| Using python find the sqaure root of 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:29&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:33&lt;br /&gt;
| 3 star star 0.5 gives the square root of 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:39&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;Now, Is 3 star star 1 slash 2 and 3 star star 0 point 5 same? &amp;lt;Pause&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:54&lt;br /&gt;
|Now switch to terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:57&lt;br /&gt;
| And let us try both these operations.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:00&lt;br /&gt;
|So type 3 star star 0 point 5 and hit enter&lt;br /&gt;
3 star star 1 slash 2 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:15&lt;br /&gt;
| As you can see,the first operation gives an integer, whereas the second one gives a float.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:19&lt;br /&gt;
| Hence,though both mean the same,they give different outputs.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:24&lt;br /&gt;
| Let us now discuss sequence data types in Python. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:27&lt;br /&gt;
| Sequence data types are those in which elements are kept in a sequential order and all the elements are accessed using index numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:38&lt;br /&gt;
| The sequence datatypes in Python are&lt;br /&gt;
&lt;br /&gt;
* list&lt;br /&gt;
* string&lt;br /&gt;
* tuple&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:43&lt;br /&gt;
| The list type is a container that holds a number of other objects, in the given order.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:51&lt;br /&gt;
| We create our first list by typing&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:55&lt;br /&gt;
|So type num underscore list = within square bracket 1 comma 2 comma 3 comma 4&lt;br /&gt;
num underscore list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:08&lt;br /&gt;
| Items enclosed in square brackets separated by comma constitutes a list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:14&lt;br /&gt;
| Lists can store data of any type in them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:18&lt;br /&gt;
| We have a list something like var underscore list = within square bracket 1 comma 1 point 2 comma then again within square bracket 1 comma 2&lt;br /&gt;
var underscore list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:45&lt;br /&gt;
| Lets look at another sequence data type, strings&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:49&lt;br /&gt;
|So you can type greeting underscore string= within double quotes hello &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:01&lt;br /&gt;
| greeting_string is now a string variable with the value &amp;quot;hello&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:07&lt;br /&gt;
| Python strings can actually be defined in three different ways&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:12&lt;br /&gt;
|k=within single qoute write Single quote&lt;br /&gt;
&lt;br /&gt;
l=within double qoutes Let's see how to include a single quote&lt;br /&gt;
m=within double qoutes Let's see how to include both&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  12:34&lt;br /&gt;
| As you can see, single quotes are used as delimiters usually.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:38&lt;br /&gt;
| When a string contains a single quote, double quotes are used as delimiters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:44&lt;br /&gt;
| When a string quote contains both single and double quotes, triple quotes are used as delimiters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:55&lt;br /&gt;
| The last in the list of sequence data types is tuple.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:59&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;To create a tuple we use normal brackets '(' unlike  square bracket '[' for lists.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:07&lt;br /&gt;
|So you can type num underscore tuple = within bracket 1 to 8  separeted by comma&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:18&lt;br /&gt;
| Because of their sequential property there are certain functions and operations we can apply to all of them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:25&lt;br /&gt;
| The first one is accessing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:28&lt;br /&gt;
| They can be using index numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:31&lt;br /&gt;
|So type in terminal num underscore list within square bracket 2&lt;br /&gt;
num underscore list within square bracket -1&lt;br /&gt;
greeting underscore string within square bracket 1&lt;br /&gt;
greeting underscore string within square bracket 3&lt;br /&gt;
greeting underscore string within square bracket -2&lt;br /&gt;
num underscore tuple within square bracket 2&lt;br /&gt;
num underscore tuple within square bracket -3&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:08&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;Indexing starts from 0, from left to right and from -1 when accessing lists in reverse.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:14&lt;br /&gt;
| Thus num underscore list[2] refers to the third element 3. and greetings [-2] is the second element from the end , that is 'l'.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:26&lt;br /&gt;
| Addition gives a new sequence containing both sequences&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:30&lt;br /&gt;
|So type num underscore list + var  underscore list in terminal.&lt;br /&gt;
&lt;br /&gt;
Then a underscore string= within double quote another string&lt;br /&gt;
greeting underscore string+a underscore string&lt;br /&gt;
t2= 3 4 6 7 separated by commas in bracket&lt;br /&gt;
num underscore tuple+t2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:17&lt;br /&gt;
| len function gives the length&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:20&lt;br /&gt;
|So you can type len within bracket num underscore list&lt;br /&gt;
len within bracket greeting underscore string&lt;br /&gt;
len within bracket num underscore tuple&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:43&lt;br /&gt;
| We can check the containership of an element using the 'in' keyword&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:50&lt;br /&gt;
|So you can type in temainal and check so that you can see the difference.So type &lt;br /&gt;
3 in num underscore list&lt;br /&gt;
Then type in single quotes 'H' in greeting underscore string&lt;br /&gt;
2 in num underscore tuple&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:15&lt;br /&gt;
| We see that it gives True and False accordingly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  16:18&lt;br /&gt;
| Find maximum using max function and minimum using min&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16:23&lt;br /&gt;
|Check that by typing in terminal&lt;br /&gt;
max within bracket num underscore tuple&lt;br /&gt;
min within bracket greeting underscore string&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:39&lt;br /&gt;
| Get a sorted list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16:42&lt;br /&gt;
|So you can type sorted within bracket num underscore list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:50&lt;br /&gt;
| As a consequence of their order, we can access a group of elements in a sequence, together.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:57&lt;br /&gt;
| This is called slicing and striding.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:00&lt;br /&gt;
| First lets discuss Slicing,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:02&lt;br /&gt;
| Given a list j= within square bracket 1 to 6&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:09&lt;br /&gt;
| Lets say we want elements starting from 2 and ending in 5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:14&lt;br /&gt;
| For this we can do j witin square bracket 1 colon 4&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:24&lt;br /&gt;
| The syntax for slicing is, sequence variable name, square bracket, first element index, colon, second element index. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:36&lt;br /&gt;
| The first element however is not included in the resultant list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17:39&lt;br /&gt;
|So you can type j within square bracket colon 4&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:49&lt;br /&gt;
| If first element is left blank default is from beginning and if last element is left blank it means till the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:14&lt;br /&gt;
|So you can type in the terminal &lt;br /&gt;
j within square bracket 1 colon&lt;br /&gt;
j within square bracket colon &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:30&lt;br /&gt;
| This effectively is the whole list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:33&lt;br /&gt;
| Striding is similar to slicing except that the step size here is not one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:39&lt;br /&gt;
|So let us see an example&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:41&lt;br /&gt;
|So type new underscore num underscore list=1 to 10 separated by commas within square bracket &lt;br /&gt;
new underscore num underscore list within square bracket 1 colon 8 colon 2 then on the other line&lt;br /&gt;
within square bracket 2 4 6 8 separated by commas that will be the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:07&lt;br /&gt;
| The, colon two, added in the end signifies all the alternate elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:15&lt;br /&gt;
| This is why we call this concept striding because we move through the list with a particular stride or step.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:23&lt;br /&gt;
| The step in this example being 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:25&lt;br /&gt;
| We have talked about many similar features of lists, strings and tuples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:32&lt;br /&gt;
|  But there are many important features in lists that differ from strings and tuples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:37&lt;br /&gt;
| Lets see this by example.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:40&lt;br /&gt;
|Type new underscore num underscore list within square bracket[1]=9&lt;br /&gt;
&lt;br /&gt;
greeting underscore string within sqaure bracket 1 =within single quote k&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:59&lt;br /&gt;
|We can see an error&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:03&lt;br /&gt;
| As you can see while the first command executes with out a problem there is an error on the second one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:10&lt;br /&gt;
| Now lets try new underscore tuple within square bracket 1=5 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:19&lt;br /&gt;
| Its the same error. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:23&lt;br /&gt;
| This is because strings and tuples share the property of being immutable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:28&lt;br /&gt;
| We cannot change the value at a particular index just by assigning a new value at that position.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:34&lt;br /&gt;
| We have looked at different types but we need to convert one data type into another.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:39&lt;br /&gt;
| Well lets one by one go through methods by which we can convert one data type to other&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:45&lt;br /&gt;
|So type i=34&lt;br /&gt;
d=float within bracket i&lt;br /&gt;
d&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:00&lt;br /&gt;
| Python has built in functions int, float and complex to convert one number type data structure to another.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:08&lt;br /&gt;
|So type dec=2.34&lt;br /&gt;
dec underscore con=int(dec)&lt;br /&gt;
dec underscore con&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:29&lt;br /&gt;
| As you can see the decimal part of the number is simply stripped to get the integer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:35&lt;br /&gt;
|So type com=2.3+4.2j&lt;br /&gt;
floatwithin bracket com&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:56&lt;br /&gt;
|So here we are getting another error&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:05&lt;br /&gt;
|So here the error can be solved by your side.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 22:10&lt;br /&gt;
| Similarly we can convert list to tuple and tuple to list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:15&lt;br /&gt;
|For that type lst= 3 4 5 6 separated by comma&lt;br /&gt;
tup=tuple within bracket lst&lt;br /&gt;
Then type lst&lt;br /&gt;
Then type tupl=3 comma 23 comma 4 comma 56 in bracket&lt;br /&gt;
lst=list within bracket tupl&lt;br /&gt;
Then type tupl&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 22:54&lt;br /&gt;
| However converting a string to a list and a list to a string is an interesting problem.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 22:59&lt;br /&gt;
| Let's say we have a string somestring= within double quote Is there a way to split on these spaces.&lt;br /&gt;
somestring.split() function, so it will spilt.Hit by command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 23:28&lt;br /&gt;
| This produces a list with the string split at whitespace. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 23:33&lt;br /&gt;
| Similarly we can split on some other character.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:37&lt;br /&gt;
|So you can type otherstring=within double quote Tim comma Amy comma Stewy comma Boss&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 23:48&lt;br /&gt;
| How do we split on comma , simply pass it as argument&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|23:56&lt;br /&gt;
|So you can type on the terminal otherstring.split within bracket comma in single quote and hit enter &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 24:06&lt;br /&gt;
| join function does the opposite.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 24:10&lt;br /&gt;
| Joins a list to make a string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|24:14&lt;br /&gt;
|So you can type l1=within square bracket List comma joined comma on comma commas,all within single quote&lt;br /&gt;
&lt;br /&gt;
Then type , within single quote comma .join within bracket l1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 25:02&lt;br /&gt;
| Thus we get a list joined on commas.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 25:05&lt;br /&gt;
| Similarly we can do spaces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|25:07&lt;br /&gt;
|So you can type l2=Within square brackets in single quote Now comma on comma spaces. &lt;br /&gt;
And we can type in single quote space.join within bracket l2, so you will get out put.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 25:27&lt;br /&gt;
| Note that the list has to be a list of strings to apply join operation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 25:32&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|25:38&lt;br /&gt;
| '''&amp;lt;nowiki&amp;gt;Check if 3 is an element of the list [1 comma 7 comma 5 comma 3 comma 4]. In case&amp;lt;/nowiki&amp;gt;''' it is change it to 21.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|25:56&lt;br /&gt;
| Switch to the terminal for solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|26:00&lt;br /&gt;
|Type l=[1 comma 7 comma 5 comma 3 comma 4&lt;br /&gt;
3 in l&lt;br /&gt;
l in square bracket 3=21&lt;br /&gt;
l&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 26:22&lt;br /&gt;
| Let us solve one more exercise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 26:24&lt;br /&gt;
| Pause the video here, do the exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 26:31&lt;br /&gt;
| Convert the string &amp;quot;Elizabeth is queen of england&amp;quot; to &amp;quot;Elizabeth is queen&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 26:39&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|26:43&lt;br /&gt;
|So s=Elizabeth is queen of england in double quotes&lt;br /&gt;
stemp=s.split()&lt;br /&gt;
within single quote space.join within brqacket stemp within square bracket colon 3 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:07&lt;br /&gt;
| As you can see, we have easily removed the unwanted words.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:11&lt;br /&gt;
| This brings us to the end of the tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:14&lt;br /&gt;
| In this tutorial, we have learnt to, 1. Understand the number Datatypes -- integer,float and complex.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:21&lt;br /&gt;
| 2. Know the boolean datatype and operators  +, backslash, percent that is modulo and * for multiplication .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:33&lt;br /&gt;
| 3. use the sequence data types -- List,String and Tuple.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:36&lt;br /&gt;
| 4. Slice sequences by using the row and column numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:41&lt;br /&gt;
| 5. Split and join a list using &amp;lt;tt&amp;gt;split()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;join()&amp;lt;/tt&amp;gt; function respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:49&lt;br /&gt;
| 6. Convert to string to tuple and vice-versa.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:54&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 27:58&lt;br /&gt;
| 1. What is the major diffence between tuples and lists?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 28:02&lt;br /&gt;
| 2. Split this string on whitespaces&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 28:05&lt;br /&gt;
| string=&amp;quot;Split this string on whitespaces&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 28:09&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|28:12&lt;br /&gt;
| 1. The major diffence between tuples and lists is that Tuples are immutable while lists are not.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 28:20&lt;br /&gt;
| 2. '''To split the string on whitespace, we use the function'''&amp;lt;br/&amp;gt; `` split`` without any argument&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 28:26&lt;br /&gt;
| string.split() function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  28:29&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|28:34&lt;br /&gt;
| Thank You.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Using-sage-to-teach/English-timed</id>
		<title>Python/C2/Using-sage-to-teach/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Using-sage-to-teach/English-timed"/>
				<updated>2013-01-02T12:01:47Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- |0:02 | Hello friends and welcome to the tutorial on 'Using SAGE to teach'.  |- |  0:07 | At the end of this tutorial, you will be able to,  # U…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:02&lt;br /&gt;
| Hello friends and welcome to the tutorial on 'Using SAGE to teach'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:07&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; feature of SAGE for better demonstration.&lt;br /&gt;
# Share, publish and edit SAGE worksheets for collaborative learning.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:19&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Sage&amp;quot; and &amp;quot;Getting started with Symbolics.&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:30&lt;br /&gt;
| Let us start by looking at a typical example of demonstrating a damped oscillation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:40&lt;br /&gt;
|So you can type t=var('t') ,then next line you can type p1=plot (e raised to minus (-t)into sin of (2 into t),(t,0,15))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:06&lt;br /&gt;
|then third line you can type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:17&lt;br /&gt;
| Now let us reduce the damping factor by half&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:23&lt;br /&gt;
|so for that you have to type t=var('t')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
|then p1=plot(e raised to (-t by 2) * sin(2 into t),(t,0,15))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:48&lt;br /&gt;
|then third line you can type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:53&lt;br /&gt;
| Now, if we want to reduce the damping factor even more, we would be using e charat to (-t by 3).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:04&lt;br /&gt;
| We can observe that every time we have to change, all we do is change something very small and re-evaluate the cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:10&lt;br /&gt;
|This process can be simplified, using the &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; feature of SAGE.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:17&lt;br /&gt;
|So you can type &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; ,then def plot_damped(n-1):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:32&lt;br /&gt;
|Then, t=var('t')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|p1=plot (e raised to(-t/n) * sin(2*t),(t,0,20))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:01&lt;br /&gt;
|then type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:11&lt;br /&gt;
| We can see that the function is evaluated and the plot is shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:15&lt;br /&gt;
| We can also see that there is a field to enter the value of &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; and it is currently set to &amp;lt;tt&amp;gt;1&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:21&lt;br /&gt;
| Let us change it to 2 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:23&lt;br /&gt;
|So you type 2 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:29&lt;br /&gt;
| We see that the new plot with reduced damping factor is shown.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:33&lt;br /&gt;
| Similarly we can change &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; to any desired value and hit enter and the function will be evaluated.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:41&lt;br /&gt;
|This is a very handy tool while demonstrating or teaching.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:45&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:50&lt;br /&gt;
| '''Plot the sine curve and vary its frequency using the &amp;lt;tt&amp;gt;@interact'''&amp;lt;/tt&amp;gt; feature.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:57&lt;br /&gt;
| Now, switch to your worksheet for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:03&lt;br /&gt;
|You can type @interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:08&lt;br /&gt;
|then def sine_plot(n=1):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:12&lt;br /&gt;
|then x=var('x')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:18&lt;br /&gt;
|then p2=plot (sin(n*x),(x,0,2*pi))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:27&lt;br /&gt;
|then finally you can type show(p2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:43&lt;br /&gt;
|So often we would want to vary a parameter over range instead of taking it as an input from the user.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:51&lt;br /&gt;
| For instance we would not want the user to give &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; as 0 for the damping oscillation we discussed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:56&lt;br /&gt;
| In such cases we use a range of values as the default argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:02&lt;br /&gt;
|at the rate interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:10&lt;br /&gt;
|should be typed in the worksheet so in the worksheet you can type&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:14&lt;br /&gt;
|@interact then def plot underscore damped(n=(1..10)):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|then next line you can type t=var('t')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:36&lt;br /&gt;
|then p1=plot(e raised to (-t/n) * sin(2*t)),(t,0,20))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:52&lt;br /&gt;
|then you can type show(p1)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:08&lt;br /&gt;
|Now we had seen an error&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
|So the error that we have rectified is after sin(2*t) we have accidently placed an extra bracket.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:25&lt;br /&gt;
| So we get similar plot but the only difference is the input widget.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:30&lt;br /&gt;
| Here it is a slider unlike an input field.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:35&lt;br /&gt;
| We can see that the slider is moved, the function is evaluated and plotted accordingly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:48&lt;br /&gt;
|Pause the video here,and try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:52&lt;br /&gt;
| '''Take a string as input from user and circular shift it to the left and''' vary the shift length using a slider.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:03&lt;br /&gt;
| For this problem, again we will use the &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; feature of sage. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:09&lt;br /&gt;
|We shall first assign a string say 'MADAM' to a variable and then shift the alphabets one by one.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:17&lt;br /&gt;
|So we can type @interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:21&lt;br /&gt;
|def str_shift(s=&amp;quot;MADAM&amp;quot;, shift=(0..8)) colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:33&lt;br /&gt;
|then you can type shift_len=shift modulus len(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:40&lt;br /&gt;
|then chars=list(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:46&lt;br /&gt;
|then shifted_chars=chars[shift_len:]+chars[: shift_len]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:03&lt;br /&gt;
|then print &amp;quot;Actual String:&amp;quot;,s&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:11&lt;br /&gt;
|then print &amp;quot;Shifted String:&amp;quot;, &amp;quot;&amp;quot;.join(shifted_chars)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:28&lt;br /&gt;
| As we move the slider, we see that shifting is taking place.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:40&lt;br /&gt;
| Sometimes we want the user to have only a given set of options.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:44&lt;br /&gt;
| We use a list of items as the default argument in such situations.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:50&lt;br /&gt;
|So we can type @interact&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:57&lt;br /&gt;
|then def str_shift(s=&amp;quot;STRING&amp;quot;,shift=(0..8), direction=[&amp;quot;Left&amp;quot;,&amp;quot;Right&amp;quot;]):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
|then next line shift_len=shift modulus len(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:24&lt;br /&gt;
|then chars=list(s)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:26&lt;br /&gt;
|if direction==&amp;quot;Right&amp;quot; colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:32&lt;br /&gt;
|then shifted_chars=chars[-shift_len colon]+chars[colon -shift_len]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:01&lt;br /&gt;
|else colon shifted_chars=chars[shift_len colon]+chars[colon shift_len]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:26&lt;br /&gt;
|then type print &amp;quot;Actual String:&amp;quot;,s&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:32&lt;br /&gt;
|then print &amp;quot;Shifted String:&amp;quot;, &amp;quot;&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:52&lt;br /&gt;
|then dot join(shifted_chars)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:01&lt;br /&gt;
| We can see that buttons are displayed which enables us to select from a given set of options.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:11&lt;br /&gt;
| We see that, as we select left or right button, the shifting takes place appropriately.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:18&lt;br /&gt;
|Thus, we have learnt how to use the &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; feature of SAGE for better demonstration.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:24&lt;br /&gt;
| Now we shall look at how to use SAGE worksheets for collaborative learning.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:30&lt;br /&gt;
| The first feature we shall see is the &amp;lt;tt&amp;gt;publish&amp;lt;/tt&amp;gt; feature.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:34&lt;br /&gt;
| Open a worksheet and in the top right, we can see a button called &amp;lt;tt&amp;gt;publish&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:40&lt;br /&gt;
|Click on that and we get a confirmation page with an option for re-publishing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:52&lt;br /&gt;
| For now lets forget that option and simply publish by clicking &amp;lt;tt&amp;gt;yes&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:58&lt;br /&gt;
|The worksheet is now published.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:59&lt;br /&gt;
|Now lets sign out and go to the sage notebook home. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:04&lt;br /&gt;
|We see link to browse published worksheets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:08&lt;br /&gt;
| Lets click on it and we can see the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:12&lt;br /&gt;
| This does not require login and anyone can view the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:17&lt;br /&gt;
|Alternatively, if one wants to edit the sheet, there is a link on top left corner that enables the user to download a copy of the sheet onto their home. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:36&lt;br /&gt;
|This way they can edit a copy of the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:41&lt;br /&gt;
|We have learnt how to publish the worksheets to enable users to edit a copy.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:45&lt;br /&gt;
|Next, we shall look at how to enable users to edit the actual worksheet itself.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:51&lt;br /&gt;
| Let us open the worksheet and we see a link called &amp;lt;tt&amp;gt;share&amp;lt;/tt&amp;gt; on the top right corner of the worksheet. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:03&lt;br /&gt;
|Click the link and we get a box where we can type the usernames of users whom we want to share the worksheet with.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:10&lt;br /&gt;
| We can even specify multiple users by separating their names using commas.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:15&lt;br /&gt;
| Once we have shared the worksheet, the worksheet appears on the home of shared users.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:22&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:24&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:25&lt;br /&gt;
| Use interactive features of SAGE using &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:30&lt;br /&gt;
| then publishing our work.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:32&lt;br /&gt;
|then edit a copy of one of the published worksheets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:35&lt;br /&gt;
|then share the worksheets with fellow users.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  13:39&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:44&lt;br /&gt;
|1. Which default argument, when used with &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; gives a slider starting at 0 and ending in 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:52&lt;br /&gt;
| options are (0..11)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:54&lt;br /&gt;
| then range(0, 11)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:55&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;Then [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10] &amp;lt;/nowiki&amp;gt; separated by comma &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:01&lt;br /&gt;
| then in brackets (0..10)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:05&lt;br /&gt;
|2. What is the input widget resulted by using &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;n = [2, 4, 5, 9]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; in the default arguments along with &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:23&lt;br /&gt;
| options are input field,  set of buttons, slider, None&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:29&lt;br /&gt;
| Now we will look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:31&lt;br /&gt;
|1.The default argument, used with &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; which gives a slider starting at 0 and ending in 10 is (0..10).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:42&lt;br /&gt;
|2. The input widget resulted by using &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;n = [2, 4, 5, 9]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; in the default arguments along with &amp;lt;tt&amp;gt;@interact&amp;lt;/tt&amp;gt; will be a set of buttons that is the second one.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:57&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:01&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Using-Sage/English-timed</id>
		<title>Python/C2/Using-Sage/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Using-Sage/English-timed"/>
				<updated>2013-01-02T12:00:47Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Welcome to the tutorial on 'Using Sage'.  |- | 0:02 | At the end of this tutorial, you will be able to,  # Learn the range of things fo…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Welcome to the tutorial on 'Using Sage'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:02&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Learn the range of things for which Sage can be used.&lt;br /&gt;
# Know the functions used for Calculus in Sage.&lt;br /&gt;
# Learn about graph theory and number theory using Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:16&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Sage&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:22&lt;br /&gt;
|Let us begin with Calculus. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:24&lt;br /&gt;
|We shall be looking at limits, differentiation, integration, and Taylor polynomial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:30&lt;br /&gt;
| We have our Sage notebook running.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:32&lt;br /&gt;
| In case, you don't have it running, start is using the command, &amp;lt;tt&amp;gt;sage --notebook&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:39&lt;br /&gt;
|So type sage and specify notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:45&lt;br /&gt;
|So to find the limit of the function x into sin(1/x), at x=0, we say by typing it lim(x*sin(1/x),x=0)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:07&lt;br /&gt;
| We get the limit to be 0, as expected.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:11&lt;br /&gt;
|It is also possible to limit a point from one direction. For example, let us find the limit of 1/x at x=0, when approaching from the positive side.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:23&lt;br /&gt;
|lim within brackets (1/x, x=0, dir='right')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:32&lt;br /&gt;
| To find the limit from the negative side, we say,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|lim(1/x, x=0, dir='left') &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:45&lt;br /&gt;
| Let us see how to perform differentiation, using Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:51&lt;br /&gt;
| We shall find the differential of the expression &amp;lt;tt&amp;gt;exp of (sin(x squared)) by x&amp;lt;/tt&amp;gt; with respect to &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:11&lt;br /&gt;
| For this, we shall first define the expression, and then use the &amp;lt;tt&amp;gt;diff&amp;lt;/tt&amp;gt; function to obtain the differential of the expression.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:21&lt;br /&gt;
|So we can type var('x)&lt;br /&gt;
 f=exp of (sin x squared)/x and then third line you can type&lt;br /&gt;
 diff(f,x)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:44&lt;br /&gt;
| We can also obtain the partial differentiation of an expression w.r.t one of the variables.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:51&lt;br /&gt;
| Let us differentiate the expression &amp;lt;tt&amp;gt;exp(sin (y - x squared))/x&amp;lt;/tt&amp;gt; w.r.t x and y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:07&lt;br /&gt;
|that is with respect to x and y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:10&lt;br /&gt;
|so you can type var('x y')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:15&lt;br /&gt;
|second line you can type f=exp(sin(y - x squared))by x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:26&lt;br /&gt;
|then you can type diff(f,x) then next line you can type diff(f,y)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:43&lt;br /&gt;
| Thus we get our partial differential solution. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:51&lt;br /&gt;
|Now, let us look at integration.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:53&lt;br /&gt;
| We shall use the expression obtained from the differentiation that we did before, &amp;lt;tt&amp;gt;diff(f, y)&amp;lt;/tt&amp;gt; which gave us the expression ---&amp;lt;tt&amp;gt;e^(sin(-x squared + y)) multiplied by cos(-x squared plus y) by x&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:15&lt;br /&gt;
| The &amp;lt;tt&amp;gt;integrate&amp;lt;/tt&amp;gt; command is used to obtain the integral of an expression or function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:21&lt;br /&gt;
|So you can type integrate(e^(sin(-x squared plus y))multiplied by cos(-x squared +y)by x,y)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:39&lt;br /&gt;
| As we can see,we get back the correct expression.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:44&lt;br /&gt;
| The minus sign being inside or outside the &amp;lt;tt&amp;gt;sin&amp;lt;/tt&amp;gt; function doesn't change much.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:48&lt;br /&gt;
|Now, let us find the value of the integral between the limits 0 and pi/2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:55&lt;br /&gt;
|So for that you can type integral(e^(sin(-x squared plus y))multiplied by cos(-x squared plus y) by x,y,0,pi/2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:11&lt;br /&gt;
| Hence we get our solution for definite integration. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:15&lt;br /&gt;
|Now, let us see how to obtain the Taylor expansion of an expression using sage. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:20&lt;br /&gt;
|Let us obtain the Taylor expansion of &amp;lt;tt&amp;gt;(x + 1) raised to n&amp;lt;/tt&amp;gt; up to degree 4 about 0.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:27&lt;br /&gt;
|So for that you can type var of ('x n') then type taylor within brackets((x+1) raised to n,x,0,4)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:42&lt;br /&gt;
| We easily got the Taylor expansion,using the taylor function &amp;lt;tt&amp;gt;taylor() function&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:49&lt;br /&gt;
| So this brings us to the end of the features of Sage for Calculus, that we will be looking at.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:56&lt;br /&gt;
| For more, look at the Calculus quick-ref from the Sage Wiki.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:03&lt;br /&gt;
| Next let us move on to Matrix Algebra.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:07&lt;br /&gt;
| Let us begin with solving the equation &amp;lt;tt&amp;gt;Ax = v&amp;lt;/tt&amp;gt;, where A is the matrix &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;matrix ([[1,2], [3,4]])&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; and v is the vector &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;vector ([1,2])&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:19&lt;br /&gt;
| So, to solve the equation, &amp;lt;tt&amp;gt;Ax = v&amp;lt;/tt&amp;gt; we simply say&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:23&lt;br /&gt;
|A=matrix ([1,2] comma [3,4]) then v is equal to vector([1,2])  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:35&lt;br /&gt;
|then x=A dot solve underscore right(v)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:50&lt;br /&gt;
|then you have to type&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:01&lt;br /&gt;
|then type x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:07&lt;br /&gt;
| To solve an equation, &amp;lt;tt&amp;gt;xA = v&amp;lt;/tt&amp;gt; we simply say&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:14&lt;br /&gt;
|x=A dot solve underscore left(v)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:25&lt;br /&gt;
|then type x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:32&lt;br /&gt;
| The left and right here, denote the position of &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt;, relative to x.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:36&lt;br /&gt;
|Now, let us look at Graph Theory in Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:39&lt;br /&gt;
|We shall look at some ways to create graphs and some of the graph families available in Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:45&lt;br /&gt;
|The simplest way to define an arbitrary graph is to use a dictionary of lists.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:49&lt;br /&gt;
| We create a simple graph by using the &amp;lt;tt&amp;gt;Graph()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:53&lt;br /&gt;
|So G=Graph({0:[1,2,3], 2:[4]}) and hit shift enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:13&lt;br /&gt;
| To view the visualization of the graph, we say&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:17&lt;br /&gt;
|G.show()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:24&lt;br /&gt;
| Similarly, we can obtain a directed graph using the &amp;lt;tt&amp;gt;DiGraph&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:31&lt;br /&gt;
| So ,you have to type G=DiGraph that is D and G are capital ({0 colon [1,2,3],2 colon[4]}) and hit shift enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:59&lt;br /&gt;
| Sage also provides a lot of graph families which can be viewed by typing &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;graph.&amp;lt;tab&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:04&lt;br /&gt;
| Let us obtain a complete graph with 5 vertices and then show the graph.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:09&lt;br /&gt;
| So you can type there G=graphs dot CompleteGraph(5) then type G dot show()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:28&lt;br /&gt;
| Sage provides other functions for Number theory and Combinatorics. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:35&lt;br /&gt;
|Let's have a glimpse of a few of them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:42&lt;br /&gt;
| So &amp;lt;tt&amp;gt;prime_range&amp;lt;/tt&amp;gt; gives primes in the range 100 to 200.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:46&lt;br /&gt;
|So you can type there prime_range within brackets 100,200.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:58&lt;br /&gt;
| &amp;lt;tt&amp;gt;is_prime&amp;lt;/tt&amp;gt; checks if 1999 is a prime number or not.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:05&lt;br /&gt;
| So for that you can type if_prime of (1999) and hit shift enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:13&lt;br /&gt;
|So you will get the answer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:15&lt;br /&gt;
| &amp;lt;tt&amp;gt;factor(2001)&amp;lt;/tt&amp;gt; gives the factorized form of 2001.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:20&lt;br /&gt;
|So to see that you can type factor(2001) and hit shift enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:33&lt;br /&gt;
|So you can see the value in the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:36&lt;br /&gt;
| So the &amp;lt;tt&amp;gt;Permutations()&amp;lt;/tt&amp;gt; gives the permutations of &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[1, 2, 3, 4]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:43&lt;br /&gt;
|So for that you can type C=Permutations([1,2,3,4]) and next you can type C.list()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:57&lt;br /&gt;
| And the &amp;lt;tt&amp;gt;Combinations()&amp;lt;/tt&amp;gt; gives all the combinations of &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[1, 2, 3, 4]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:02&lt;br /&gt;
|For that you can type C= Combinations([1,2,3,4]) and type C dot list()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:17&lt;br /&gt;
|So now you can see the solution displayed&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:26&lt;br /&gt;
| This brings us to the end of the tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:29&lt;br /&gt;
| In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:32&lt;br /&gt;
|1. Use functions for calculus like -- - lim()-- to find out the limit of a function - diff()-- to find out the differentiation of an expression - integrate()-- to integrate over an expression - integral()-- to find out the definite integral of an expression by specifying the limits&amp;lt;br/&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:52&lt;br /&gt;
|solve()-- to solve a function, relative to it's position.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:56&lt;br /&gt;
|then create both a simple graph and a directed graph, using the functions &amp;lt;tt&amp;gt;graph&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;digraph&amp;lt;/tt&amp;gt; respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:02&lt;br /&gt;
|then use functions for number theory.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:04&lt;br /&gt;
|So for eg: - primes_range()-- function to find out the prime numbers within the specified range.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:11&lt;br /&gt;
|then factor()-- function to find out the factorized form of the specified number.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:15&lt;br /&gt;
| Permutations(), Combinations()-- to obtain the required permutation and combinations for the given set of values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:22&lt;br /&gt;
| So here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:25&lt;br /&gt;
|1. How do you find the limit of the function &amp;lt;tt&amp;gt;x/sin(x)&amp;lt;/tt&amp;gt; as &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt; tends to &amp;lt;tt&amp;gt;0&amp;lt;/tt&amp;gt; from the negative side.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:32&lt;br /&gt;
|2. List all the primes between 2009 and 2900&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:37&lt;br /&gt;
|3. Solve the system of linear equations&amp;lt;br/&amp;gt; x-2y+3z = 7 2x+3y-z = 5 x+2y+4z = 9&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:57&lt;br /&gt;
| So now we can look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:02&lt;br /&gt;
| 1. To find out the limit of an expression from the negative side,we add an argument dir=&amp;quot;left&amp;quot; as&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:09&lt;br /&gt;
|lim of(x/sin(x), x=0, dir=&amp;quot;left&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:19&lt;br /&gt;
|2. The prime numbers from 2009 and 2900 can be obtained as,&lt;br /&gt;
&lt;br /&gt;
 prime_range(2009, 2901)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:32&lt;br /&gt;
|3. We shall first write the equations in matrix form and then use the solve() function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:39&lt;br /&gt;
| So you can type &amp;lt;nowiki&amp;gt;A = Matrix of within brackets([[1, -2, 3] comma&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;[2, 3, -1] comma&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
             &amp;lt;nowiki&amp;gt;[1, 2, 4]])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
|13:48&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;b = vector within brackets([7, 5, 9])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
|13:52&lt;br /&gt;
|then x = A dot solve_right(b)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:58&lt;br /&gt;
|Then type x so that you can view the output of x.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:03&lt;br /&gt;
| So we hope that you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:06&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Getting-started-with-symbolics/English-timed</id>
		<title>Python/C2/Getting-started-with-symbolics/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Getting-started-with-symbolics/English-timed"/>
				<updated>2013-01-02T11:59:42Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:02 | Hello friends and welcome to the tutorial on &amp;quot;Symbolics with Sage&amp;quot;.  |- | 0:07 | At the end of this tutorial, you will be able to,  # D…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:02&lt;br /&gt;
| Hello friends and welcome to the tutorial on &amp;quot;Symbolics with Sage&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:07&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Define symbolic expressions in sage.&lt;br /&gt;
# Use built-in constants and functions.&lt;br /&gt;
# Perform Integration, differentiation using sage.&lt;br /&gt;
# Define matrices.&lt;br /&gt;
# Define Symbolic functions.&lt;br /&gt;
# Simplify and solve symbolic expressions and functions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:24&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with sage notebook&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:31&lt;br /&gt;
|In addition to a lot of other things, Sage can do Symbolic Math and we shall start with defining symbolic expressions in Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:42&lt;br /&gt;
| Have your Sage notebook opened. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:44&lt;br /&gt;
|If not, pause the video and start you Sage notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:49&lt;br /&gt;
| On the sage notebook type sine y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:08&lt;br /&gt;
|Then click shift enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:12&lt;br /&gt;
| It raises a name error saying that &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; is not defined.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:14&lt;br /&gt;
| We need to declare &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt; as a symbol.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:17&lt;br /&gt;
| We do it using the &amp;lt;tt&amp;gt;var&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:19&lt;br /&gt;
|So type var within brackets and single quotes y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:28&lt;br /&gt;
| Now if you type sin within brackets y,Sage simply returns the expression.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:32&lt;br /&gt;
|So type sine y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:37&lt;br /&gt;
| Now, sage treats &amp;lt;tt&amp;gt;sin of y&amp;lt;/tt&amp;gt; as a symbolic expression. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:42&lt;br /&gt;
|We can use this to do symbolic math using Sage's built-in constants and expressions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:47&lt;br /&gt;
|Let us try out a few examples.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:50&lt;br /&gt;
|So let us type var within brackets and single quotes x comma alpha comma y comma beta&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:59&lt;br /&gt;
|Then next line you can type x charat 2 by alpha charat 2 plus y charat 2 by beta charat 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:10&lt;br /&gt;
|That is x squared by alpha squared plus y squared by beta squared.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:17&lt;br /&gt;
| We have defined 4 variables, &amp;lt;tt&amp;gt;x&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;y&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;alpha&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;beta&amp;lt;/tt&amp;gt; and have defined a symbolic expression using them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
|Here is an expression in &amp;lt;tt&amp;gt;theta&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:29&lt;br /&gt;
|So you can type var within brackets and single quotes theta&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:38&lt;br /&gt;
|then sine within brackets theta multiplied by sine within brackets theta plus cos within brackets theta multiplied by cos within brackets theta&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:55&lt;br /&gt;
| Now that you know how to define symbolic expressions in Sage, here is an exercise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:01&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:05&lt;br /&gt;
| Define following expressions as symbolic expressions in Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:11&lt;br /&gt;
|that is  x squared plus y squared&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:13&lt;br /&gt;
|and next one is. y squared minus 4 ax&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:18&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:25&lt;br /&gt;
|that is var within brackets and single quotes x,y then x squared plus y squared that is x charat 2 plus y charat 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:33&lt;br /&gt;
|then next is var within brackets and single quotes a,x,y then y charat 2 minus 4 into a into x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:49&lt;br /&gt;
| Sage also provides built-in constants which are commonly used in mathematics, for instance pi, e, infinity. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:56&lt;br /&gt;
|The function &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt; gives the numerical values of all these constants.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:00&lt;br /&gt;
|So you can type n within brackets pi then n within brackets e then n within brackets zero zero that is oo.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:18&lt;br /&gt;
| If you look into the documentation of function &amp;lt;tt&amp;gt;n&amp;lt;/tt&amp;gt;&amp;lt;nowiki&amp;gt; by doing n&amp;lt;tab&amp;gt;, You will see what all arguments it takes and what it returns.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:26&lt;br /&gt;
| So you can type n and hit tab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:30&lt;br /&gt;
| It will be very helpful if you look at the documentation of all functions introduced in the course of this script.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:36&lt;br /&gt;
| Also we can define the number of digits we wish to have in the constants.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:40&lt;br /&gt;
| For this we have to pass an argument -- digits.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:46&lt;br /&gt;
|So you can type n within brackets pi comma space digits is equal to 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:01&lt;br /&gt;
| Apart from the constants Sage also has a lot of built-in functions like &amp;lt;tt&amp;gt;sin&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;cos&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;log&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;factorial&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;gamma&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;exp&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;arctan&amp;lt;/tt&amp;gt; which stands for arctangent etc ...&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:16&lt;br /&gt;
|So let us try some of them out on the Sage notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:21 &lt;br /&gt;
|so you can type sine within brackets pi by 2 then arctan oo then log within brackets&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:44&lt;br /&gt;
|so when you type artan , there is an error in arc so we have to type arctan. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:54&lt;br /&gt;
|Then type log e comma e&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:03&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:06&lt;br /&gt;
| Find the values of the following constants upto 6 digits precision&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:14&lt;br /&gt;
|First option is  pi charat 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:18&lt;br /&gt;
|then euler underscore gamma charat 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:23&lt;br /&gt;
|Find the value of the following.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:26&lt;br /&gt;
|1. sin of pi divided by 4&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:28&lt;br /&gt;
|Next one is . ln of 23.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:32&lt;br /&gt;
| The solutions are on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:36&lt;br /&gt;
|that is n into within brackets pi squared comma digits equal to 6,next one is n into within brackets sin pi by 4 and then third one is n into within brackets log 23 comma e&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:05&lt;br /&gt;
| Given that we have defined variables like x, y etc., we can define an arbitrary function with desired name in the following way.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:14&lt;br /&gt;
|So you can type var within brackets and single quotes x and then next line function within brackets and single quotes f comma x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:33&lt;br /&gt;
| Here f is the name of the function and x is the independent variable .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:37&lt;br /&gt;
| Now we can define f of x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:40&lt;br /&gt;
|that is f of x within brackets x is equal to x by 2 plus sin x.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:53&lt;br /&gt;
| Evaluating this function f for the value x=pi returns pi by 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:01&lt;br /&gt;
|So type f within brackets pi&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:07&lt;br /&gt;
|so we will get the answer as 1 by 2 into pi.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:12&lt;br /&gt;
| We can also define functions that are not continuous but defined piecewise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:18&lt;br /&gt;
| Let us define a function which is a parabola between 0 to 1 and a constant from 1 to 2 .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:24&lt;br /&gt;
|We shall use the function &amp;lt;tt&amp;gt;Piecewise&amp;lt;/tt&amp;gt; which returns a piecewise function from a list of pairs.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:31&lt;br /&gt;
| We can type the following&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:35&lt;br /&gt;
|var within brackets in single quotes x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:41&lt;br /&gt;
|then f of x is equal to x charat 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:52&lt;br /&gt;
|then v of x is equal to 1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:58&lt;br /&gt;
|then next line we can type f is equal to piecewise within brackets 0 comma 1 then comma x then another bracket x then next square bracket it is 1,2, g of x comma x then type f&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:21&lt;br /&gt;
| We can also define functions convergent series and other series.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:26&lt;br /&gt;
| We first define a function f(n) in the way discussed before.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:29 &lt;br /&gt;
|So we can type var within brackets n in single quotes&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:39&lt;br /&gt;
|then type function within brackets f,n&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:53&lt;br /&gt;
|var('n')&lt;br /&gt;
function('f', n)&lt;br /&gt;
To sum the function for a range of discrete values of n, we use the sage function sum. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:03&lt;br /&gt;
|For a convergent series , f(n)=1 by n raised to 2 we can say by typing&lt;br /&gt;
&lt;br /&gt;
var('n')&lt;br /&gt;
&lt;br /&gt;
function('f', n)&lt;br /&gt;
&lt;br /&gt;
f(n) = 1/n^2&lt;br /&gt;
&lt;br /&gt;
sum(f(n), n, 1, oo)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:55&lt;br /&gt;
| Let us now try another series&lt;br /&gt;
f(n) = (-1)^(n-1)*1/(2*n - 1)&lt;br /&gt;
sum(f(n), n, 1, oo)&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:33&lt;br /&gt;
| This series converges to pi by 4. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:40&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:46&lt;br /&gt;
| Define the piecewise function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:47&lt;br /&gt;
| f of x is equal to 3x plus 2 when x is in the closed interval 0 to 4.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:55&lt;br /&gt;
| f of x is equal to 4x squared  between 4 to 6.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:03&lt;br /&gt;
|Sum of 1 by within brackets n squared -1 where n ranges from 1 to infinity.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:11&lt;br /&gt;
| The solution is on your screen&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:13&lt;br /&gt;
|var('x') ,h(x) = 3 into x plus 2 g(x) is equal to  4 into x squared , f = Piecewise within brackets  again square brackets and square brackets again and within closing brackets 0,4,h(x),(4,6),g(x),x &lt;br /&gt;
|-&lt;br /&gt;
|12:40&lt;br /&gt;
|Next step you have to type var('n') f = 1/(n squared minus 1) sum(f(n), n, 1, oo)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:00&lt;br /&gt;
| Moving on let us see how to perform simple calculus operations using Sage&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:05&lt;br /&gt;
| For example lets try an expression first&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  13:18&lt;br /&gt;
| The diff function differentiates an expression or a function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:27&lt;br /&gt;
| It's first argument is expression or function and second argument is the independent variable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:33&lt;br /&gt;
| We have already tried an expression now lets try a function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:41&lt;br /&gt;
|f = exp(x^2) + arcsin(x)&lt;br /&gt;
diff(f(x),x)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  14:00&lt;br /&gt;
|To get a higher order differential we need to add an extra third argument for order so you can type&lt;br /&gt;
diff(f(x),x,3)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:35&lt;br /&gt;
| in this case it is 3. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:38&lt;br /&gt;
|Just like differentiation of expression you can also integrate them&lt;br /&gt;
x = var('x')&lt;br /&gt;
s = integral(1/(1 + (tan(x))**2),x)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:18 &lt;br /&gt;
| Many a times we need to find factors of an expression, we can use the &amp;quot;factor&amp;quot; function&lt;br /&gt;
y = (x^100 - x^70)*(cos(x)^2 + cos(x)^2*tan(x)^2)&lt;br /&gt;
f = factor(y)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:46&lt;br /&gt;
| One can simplify complicated expression by using the function &amp;lt;tt&amp;gt;simplify&amp;lt;/tt&amp;gt;.&lt;br /&gt;
f.simplify_full()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:06&lt;br /&gt;
| This simplifies the expression fully.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16:07&lt;br /&gt;
| We can also do simplification of just the algebraic part and the trigonometric part&lt;br /&gt;
f.simplify_exp()&lt;br /&gt;
|-&lt;br /&gt;
|16:24&lt;br /&gt;
| f.simplify_trig()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16:33&lt;br /&gt;
|One can also find roots of an equation by using &amp;lt;tt&amp;gt;find_root&amp;lt;/tt&amp;gt; function&lt;br /&gt;
phi = var('phi')&lt;br /&gt;
find_root(cos(phi) == sin(phi),0,pi/2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  17:07&lt;br /&gt;
|Let's substitute this solution into the equation and see we were correct&lt;br /&gt;
var('phi')&lt;br /&gt;
f(phi) = cos(phi)-sin(phi)&lt;br /&gt;
root = find_root(f(phi) == 0,0,pi/2)&lt;br /&gt;
f.substitute(phi=root)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:55&lt;br /&gt;
|As we can see when we substitute the value the answer is almost = 0 showing the solution we got was correct. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:04&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:10&lt;br /&gt;
|Differentiate the following.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:12&lt;br /&gt;
|1. sin(x cubed) plus log(3x) , degree=2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:24&lt;br /&gt;
|2. x raised to 5 into log x raised to 7 , degree=4&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:32&lt;br /&gt;
|Integrate the given expression&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:33&lt;br /&gt;
|sin(x squared)+exp(x cubed)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:44&lt;br /&gt;
|'''Find x'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:45&lt;br /&gt;
|cos(x squared)-log(x)=0 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:50&lt;br /&gt;
|Does the equation have a root between 1,2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:55&lt;br /&gt;
|The solution is on your screen&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:56&lt;br /&gt;
|For the first one we have to type var('x') f(x)= x raised to 5 into log of x raised to 7 diff(f(x),x,5)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:15&lt;br /&gt;
|Next line we have to type var('x')then second line integral(x*sin(x^2),x)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:33&lt;br /&gt;
|For the third one we have to type var('x') then f=cos(x^2)-log(x) find_root(f(x)==0,1,2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:53&lt;br /&gt;
|So let us now try some matrix algebra symbolically&lt;br /&gt;
var('a,b,c,d')&lt;br /&gt;
&amp;lt;nowiki&amp;gt;A=matrix([[a,1,0],[0,b,0],[0,c,d]])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
A&lt;br /&gt;
|-&lt;br /&gt;
|  20:29&lt;br /&gt;
|Now lets do some of the matrix operations on this matrix&lt;br /&gt;
A.det()&lt;br /&gt;
A.inverse()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:46&lt;br /&gt;
|As we can see, we got the determinant and the inverse of the matrix respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:50&lt;br /&gt;
|So pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:57&lt;br /&gt;
|Find the determinant and inverse of&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:59&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;A = within brackets and again brackets x,0,1 then again brackets y,1,0 again bracket z,0,y&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:18&lt;br /&gt;
|The solution is on your screen&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:20&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;var('x,y,z') A = matrix([[x,0,1],[y,1,0],[z,0,y]])then third line you have to type A dot det function and next line you have to type A dot inverse function&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:44&lt;br /&gt;
|This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:48&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:49&lt;br /&gt;
|Define symbolic expression and functions using the method &amp;lt;tt&amp;gt;var&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|21:53&lt;br /&gt;
|Then use built-in constants like pi,e,oo and functions like sum,sin,cos,log,exp and many more.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:00&lt;br /&gt;
|Then &amp;lt;nowiki&amp;gt;use &amp;lt;Tab&amp;gt; to see the documentation of a function.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:03&lt;br /&gt;
|4. Do simple calculus using functions - diff()--to find a differential of a function - integral()--to integrate an expression - simplify--to simplify complicated expression.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:16&lt;br /&gt;
|5. Substitute values in expressions using &amp;lt;tt&amp;gt;substitute&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:19&lt;br /&gt;
|Then create symbolic matrices and perform operations on them like-- - det()--to find out the determinant of a matrix - inverse()--to find out the inverse of a matrix.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:29&lt;br /&gt;
|Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:32&lt;br /&gt;
|1. How do you define a name 'y' as a symbol?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:37&lt;br /&gt;
|2. Get the value of pi upto precision 5 digits using sage?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:41&lt;br /&gt;
|3. Find third order differential function of&amp;lt;br/&amp;gt; f(x) = sin(x^2)+exp(x^3)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:50&lt;br /&gt;
|So, the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:53&lt;br /&gt;
|1. We define a symbol using the function &amp;lt;tt&amp;gt;var&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|22:57&lt;br /&gt;
|In this case it will be&amp;lt;br/&amp;gt;  var('y')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|23:02&lt;br /&gt;
|2. The value of pi upto precision 5 digits is given as,&amp;lt;br/&amp;gt;  n(pi,5)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|23:11&lt;br /&gt;
|3. The third order differential function can be found out by adding the third argument which states the order.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|23:18&lt;br /&gt;
|The syntax will be,&amp;lt;br/&amp;gt;  diff(f(x),x,3)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|23:24&lt;br /&gt;
|Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Getting-started-with-sage-notebook/English-timed</id>
		<title>Python/C2/Getting-started-with-sage-notebook/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Getting-started-with-sage-notebook/English-timed"/>
				<updated>2013-01-02T11:57:52Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and Welcome to this spoken tutorial on &amp;quot;Getting started with Sage and Sage notebook&amp;quot;.  |- | 0:07 | At the end of this tut…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and Welcome to this spoken tutorial on &amp;quot;Getting started with Sage and Sage notebook&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:07&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Know what Sage and Sage notebook are.&lt;br /&gt;
# Start a Sage shell or notebook.&lt;br /&gt;
# Create new worksheets.&lt;br /&gt;
# Know about the menu options available and the cells in the worksheet.&lt;br /&gt;
# Evaluate cells, create and delete cells, navigate them.&lt;br /&gt;
# Make annotations in the worksheet.&lt;br /&gt;
# Use tab completion.&lt;br /&gt;
# Use code from other languages in the cells.&lt;br /&gt;
# Use the offline help available.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:30&lt;br /&gt;
| To start with, let us first understand, what is Sage? &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:33&lt;br /&gt;
|Sage is a free, open-source mathematical software. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:35&lt;br /&gt;
|Sage can do a lot of math stuff for you including, but not limited to, algebra, calculus, geometry, cryptography, graph theory among other things.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:48&lt;br /&gt;
| It can also be used as an aid in teaching and research in any of the areas that Sage supports. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:53&lt;br /&gt;
|So let us start Sage now&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:56&lt;br /&gt;
| We are assuming that you have Sage installed on your computer now. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:00&lt;br /&gt;
|If not please visit the page http colon slash slash sagemath dot org slash doc slash tutorial slash introduction dot html#installation for the tutorial on how to install Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:13&lt;br /&gt;
| Now you can open the terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:17&lt;br /&gt;
| So, let us now learn how to start Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:19&lt;br /&gt;
| So type on the terminal sage and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:27&lt;br /&gt;
| This should start a new Sage shell with the prompt sage.  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:32&lt;br /&gt;
|So now we can type all the commands that Sage supports here. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:35&lt;br /&gt;
|But Sage comes bundled with a much more elegant tool called Sage Notebook. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:40&lt;br /&gt;
|So what is Sage Notebook?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:44&lt;br /&gt;
| Sage Notebook provides a web based user interface to use Sage. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:48&lt;br /&gt;
|So once we have a Sage notebook server up and running, all we want is a browser to access the Sage functionality.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:56&lt;br /&gt;
| For example there is an official instance of Sage Notebook server running at http colon double slash sagenb dot org.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:06&lt;br /&gt;
| You can visit that page, create an account there and start using Sage!&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:09&lt;br /&gt;
| So all you need is just a modern browser to use Sage and nothing else!&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:15&lt;br /&gt;
| The Sage notebook also provides a convenient way of sharing and publishing our work, which is very handy for research and teaching.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:23&lt;br /&gt;
|However we can also run our own instances of Sage notebook servers on all the computers, if we have a local installation of Sage to start the notebook server just type notebook and brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:43&lt;br /&gt;
| This will start the Sage Notebook server. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:46&lt;br /&gt;
|If we are starting the notebook server for the first time, we are prompted to enter the password for the admin.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:52&lt;br /&gt;
| Type the password and make a note of it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:54&lt;br /&gt;
| After this Sage automatically starts a browser page for you with the notebook opened.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:01&lt;br /&gt;
|If it doesn't automatically start a browser page, check if the Notebook server started and there were no problems.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:10&lt;br /&gt;
| If so, open your browser and in the address bar, type the URL shown in the instructions upon running the notebook command on the sage prompt.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:20&lt;br /&gt;
|So you can type http colon double slash localhost colon 8000, in our case it is the point.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:31&lt;br /&gt;
| The notebook command gives an instruction telling Open your web browser to localhost colon 8000.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:40&lt;br /&gt;
| If you are not logged in yet, it shows the Notebook home page and textboxes to type the username and the password.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:48&lt;br /&gt;
| You can use the username 'admin' and the password you gave while starting the notebook server for the first time.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:54&lt;br /&gt;
| There are also links to recover forgotten password and to create new accounts.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:00&lt;br /&gt;
|Once we are logged in with the admin account we can see the notebook admin page.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:03&lt;br /&gt;
| A notebook can contain a collection of Sage Notebook worksheets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:09&lt;br /&gt;
| Worksheet is basically a working area. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:12&lt;br /&gt;
|This is where we enter all the Sage commands on the notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:17&lt;br /&gt;
| The admin page lists all the worksheets created.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:21&lt;br /&gt;
| On the topmost part of this page we have the links to various pages.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:27&lt;br /&gt;
| The home link takes us to the admin home page.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:30&lt;br /&gt;
| The published link takes us to the page which lists all the published worksheets. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:34&lt;br /&gt;
|The log link has the complete log of all the actions we did on the notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:38&lt;br /&gt;
| We have the settings link where we can configure our notebook, the notebook server, create and manage accounts.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:45&lt;br /&gt;
| We have a link to help upon clicking opens a new window with the complete help of Sage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:52&lt;br /&gt;
| The entire documentation of Sage is supplied with Sage for offline reference and this help link is the way to get into it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:01&lt;br /&gt;
| Then we can report bugs about Sage by clicking on Report a Problem link and there is a link to sign out of the notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:10&lt;br /&gt;
| We can create a new worksheet by clicking New Worksheet link&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:13&lt;br /&gt;
| Sage prompts you for a name for the worksheet. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:16&lt;br /&gt;
|Let us name the worksheet as 'nbtutorial'. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:24&lt;br /&gt;
|Now we have our first worksheet which is empty.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:31&lt;br /&gt;
|Every Sage command must be entered in this cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:34&lt;br /&gt;
| A cell is equivalent to the prompt on console.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:37&lt;br /&gt;
| When we create a new worksheet, to start with we will have one empty cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:43&lt;br /&gt;
| Let us try out some math here&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:46&lt;br /&gt;
|So you can type on the terminal 2 plus 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:52&lt;br /&gt;
|then 57 point 1 raised to 100&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:00&lt;br /&gt;
| The cap operator is used for exponentiation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:04&lt;br /&gt;
| If you observed carefully, we typed two commands but the output of only last command was displayed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
| By default each cell displays the result of only the last operation. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:16&lt;br /&gt;
|We have to use print statement to display all the results we want to be displayed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:22&lt;br /&gt;
| Now to perform more operations, we want more cells.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:27&lt;br /&gt;
| So how do we create a new cell?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:30&lt;br /&gt;
| It is very simple.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:31&lt;br /&gt;
| As we hover our mouse above or below the existing cells we see a blue line, by clicking on this new line we can create a new cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:46&lt;br /&gt;
| We have a cell, we have typed some commands in it&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:51&lt;br /&gt;
|So type matrix then within brackets 1,2,3,4 then charat then again in brackets minus 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:07&lt;br /&gt;
|but how do we evaluate that cell?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:09&lt;br /&gt;
| Pressing Shift along with Enter evaluates the cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:17&lt;br /&gt;
| Alternatively we can also click on the evaluate link to evaluate the cell&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:22&lt;br /&gt;
| After we create many cells, we may want to move between the cells.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:27&lt;br /&gt;
| To move between the cells use Up and Down arrow keys.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:31&lt;br /&gt;
| Also clicking on the cell will let you edit that particular cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:38&lt;br /&gt;
| To delete a cell, clear the contents of the cell and hit backspace&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:41&lt;br /&gt;
| If you want to add annotations in the worksheet itself, on the blue line that appears on hovering the mouse around the cell, Hold Shift and click on the line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:56&lt;br /&gt;
| This creates a What You See Is What You Get cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:09&lt;br /&gt;
|We can type in the editable cell.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:12&lt;br /&gt;
|This text contains both the bold text and italicized text.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:36&lt;br /&gt;
|Then you can type, it  also contain bulleted list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:02&lt;br /&gt;
|Then it also contain enumerated list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:29&lt;br /&gt;
| In the same cell we can display typeset math using the LaTeX like syntax&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:34&lt;br /&gt;
|So we have to type below that in dollar sign then slash int underscore zero raised to slash infty space e raised to power -x in curly brackets then slash then dx then again a dollar symbol.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:54&lt;br /&gt;
| We enclose the math to be typeset within dollar and dollar or dollar dollar and dollar dollar as in LaTeX.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:02&lt;br /&gt;
|We can also obtain help for a particular Sage command or function within the worksheet itself by using a question mark following the command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:10&lt;br /&gt;
|So you can type for ex colon sine question mark and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:24&lt;br /&gt;
|You have to press shift enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:27&lt;br /&gt;
| Evaluating this cell gives me the entire help for the sine function inline on the worksheet itself.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:34&lt;br /&gt;
| Similarly we can also look at the source code of each command or function using double question mark&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:39&lt;br /&gt;
|so for ex: you can type matrix question mark question mark then press shift and enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:48&lt;br /&gt;
| Sage notebook also provides the feature for autocompletion.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:52&lt;br /&gt;
| To autocomplete a command type first few unique characters and hit tab key&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  11:07&lt;br /&gt;
| To list all the methods that are available for a certain variable or a datatype, we can use the variable name followed by the dot to access the methods available on it and then hit tab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:20&lt;br /&gt;
|So &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:26&lt;br /&gt;
|you can type&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:28&lt;br /&gt;
|s=&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:33&lt;br /&gt;
|within single quotes hello&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:37&lt;br /&gt;
|then s dot rep then tab &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  11:51&lt;br /&gt;
| The output produced by each cell can be one of the three states.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:55&lt;br /&gt;
| It can be either the full output, or truncated output or hidden output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:00&lt;br /&gt;
| The output area will display the error, if the Sage code we wrote in the cell did not successfully execute&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:09&lt;br /&gt;
|So you can type a comma b is equal to 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:16&lt;br /&gt;
| The default output we obtained now is a truncated output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:19&lt;br /&gt;
| Clicking at the left of the output area when the mouse pointer turns to hand gives us the full output&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:30&lt;br /&gt;
| clicking again makes the output hidden and it cycles.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  12:38&lt;br /&gt;
| Lastly, Sage supports a variety of languages and each cell on the worksheet can contain code written in a specific language.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:45&lt;br /&gt;
| It is possible to instruct Sage to interpret the code in the language we have written.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:54&lt;br /&gt;
| This can be done by putting percentage sign(%) followed by the name of the language.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:01&lt;br /&gt;
| For example, to interpret the cell as Python code we put as the first line in the cell percentage symbol then python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  13:14&lt;br /&gt;
| '''Similarly we have: %sh for shell scripting,'''percentage fortran for Fortran, percentage gap for GAP and so on. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:25&lt;br /&gt;
|Let us see how this works.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:26&lt;br /&gt;
| Say I have an integer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:28&lt;br /&gt;
| The type of the integer in default Sage mode is&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:31&lt;br /&gt;
|a is equal to 1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:34&lt;br /&gt;
|Then type within brackets a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:45&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;Output will be: &amp;lt;type 'sage dot rings dot integer dot Integer'&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:52&lt;br /&gt;
|or type within colon int&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:58&lt;br /&gt;
| We see that Integers are Sage Integers. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:00&lt;br /&gt;
|Now let us put percentage python as the first line of the cell and execute the same code snippet&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:09&lt;br /&gt;
|So you can type there in the cell&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:13&lt;br /&gt;
|percentage python then a is equal to 1 then type a&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:20&lt;br /&gt;
| You can also get the &amp;lt;nowiki&amp;gt;Output colon&amp;lt;type 'int'&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:26&lt;br /&gt;
|Now we see that the integer is a Python integer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:28&lt;br /&gt;
| Why?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:29&lt;br /&gt;
| Because now we instructed Sage to interpret that cell as Python code.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:36&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:38&lt;br /&gt;
| In thus tutorial, we have learnt to, Know about Sage and sage notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:42&lt;br /&gt;
| Start Sage shell and sage notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:45&lt;br /&gt;
| Create accounts and start using the notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:48&lt;br /&gt;
| Create new worksheets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:49&lt;br /&gt;
|Access the menus available on the notebook.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:51&lt;br /&gt;
| Evaluate cells in the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:54&lt;br /&gt;
|7. delete the cells. and navigate around the cells.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:57&lt;br /&gt;
|8. Make annotations in the worksheet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:59&lt;br /&gt;
|9. Use tab completions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:00&lt;br /&gt;
|10. Embed code of other scripting languages in the cells.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:05&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:08&lt;br /&gt;
|1. Each cell in a sage worksheet displays the result of only the last operation. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:13&lt;br /&gt;
|True or False.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:14&lt;br /&gt;
|2. How do you evaluate a cell using the keyboard keys?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:17&lt;br /&gt;
| Shift key along with enter key&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:19&lt;br /&gt;
| Control key along with enter key&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:21&lt;br /&gt;
| Alt key along with enter key&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:23&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:26&lt;br /&gt;
|1.The answer is  True.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:28&lt;br /&gt;
| By default each cell displays the result of only the last operation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:31&lt;br /&gt;
|2.We have to press Shift along with Enter evaluates the cell.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:36&lt;br /&gt;
| So we hope you have enjoyed This tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:41&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Least-square-fit/English-timed</id>
		<title>Python/C3/Least-square-fit/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Least-square-fit/English-timed"/>
				<updated>2013-01-02T11:06:59Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and welcome to the tutorial on 'Least Square Fit'.  |- | 0:05 | At the end of this tutorial, you will be able to,  # …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and welcome to the tutorial on 'Least Square Fit'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Generate the least square fit line for a given set of points.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:11&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Using plot interactively&amp;quot;, &amp;quot;Loading data from files&amp;quot; and &amp;quot;Getting started with arrays&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:22&lt;br /&gt;
| Let us start this tutorial with the help of an example.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:27&lt;br /&gt;
| Generate a least square fit line for l versus t square using the data in the file 'pendulum.txt'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:36&lt;br /&gt;
| We have an input file generated from a simple pendulum experiment.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:40&lt;br /&gt;
| It contains two columns of data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:43&lt;br /&gt;
| The first column is the length of the pendulum and the second is the corresponding time period of the pendulum.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:48&lt;br /&gt;
| As we know, the square of time period of a pendulum is directly proportional to its length,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:54&lt;br /&gt;
| we shall plot l versus t square and verify this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:58&lt;br /&gt;
| To read the file input and parse the data, we are going to use the loadtxt function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:04&lt;br /&gt;
| Switch to the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:08&lt;br /&gt;
| We can see that l and t are two sequences containing length and time values correspondingly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:15&lt;br /&gt;
| Let us first plot l versus t square.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:18&lt;br /&gt;
|Type in the terminal ipython hypen pylab  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:27&lt;br /&gt;
|Type l comma  t = loadtxt within brackets in double quotes slash home slash fossee slash pendulum.txt comma  unpack=True and bracket closed.&lt;br /&gt;
Then type&lt;br /&gt;
l&lt;br /&gt;
Secondly type&lt;br /&gt;
t&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:05 &lt;br /&gt;
| We can see that there is a visible linear trend, but we do not get a straight line connecting them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:11&lt;br /&gt;
| We shall, therefore, generate a least square fit line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:15&lt;br /&gt;
| We will first generate the two matrices tsq and A.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:22&lt;br /&gt;
| Then we will use the &amp;lt;tt&amp;gt;lstsq&amp;lt;/tt&amp;gt; function to find the values of m and c.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:32&lt;br /&gt;
|Type tsq = t star t hit enter&lt;br /&gt;
Type plot within brackets l comma  tsq comma within single quotes bo hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:57&lt;br /&gt;
| let us now generate the A matrix with l values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:01&lt;br /&gt;
| We shall first generate a 2 into 90 matrix with the first row as l values and the second row as ones.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:13&lt;br /&gt;
| Then take the transpose of it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:16&lt;br /&gt;
|Type in the termianl inter underscore mat = array  within brackets l comma  ones underscore like  within brackets one then close the bracket&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:44&lt;br /&gt;
|Now we can see an error.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:47&lt;br /&gt;
|The error is in the one underscore like function we typed one instead of l so you have to put l there.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:59&lt;br /&gt;
| We can see that we have intermediate matrix.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:02&lt;br /&gt;
| Now we need the transpose.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:04&lt;br /&gt;
|So type on the terminal&lt;br /&gt;
 A = inter underscore mat.T &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:19&lt;br /&gt;
|Type A and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:22&lt;br /&gt;
| Now we have both the matrices A and tsq.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:27&lt;br /&gt;
| We only need to use the &amp;lt;tt&amp;gt;lstsq&amp;lt;/tt&amp;gt; .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:33&lt;br /&gt;
|Type result = lstsq within brackets A comma  tsq where lstsq stands for least square&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:49&lt;br /&gt;
| The result is a sequence of values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:51&lt;br /&gt;
| The first item in this sequence, is the matrix p i.e., the values of m and c.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:58&lt;br /&gt;
|Type m comma  c = result within square brackets 0 .Then type &lt;br /&gt;
 m&lt;br /&gt;
Then type &lt;br /&gt;
 c so you can see the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:20&lt;br /&gt;
| Now that we have m and c,So we need to generate the fitted values of t square.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|Type on terminal.&lt;br /&gt;
 tsq underscore fit = m star l plus c&lt;br /&gt;
 Type plot within brackets l comma tsq comma  within single quote bo&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:06&lt;br /&gt;
|Before typing that plot we have to type clear function.&lt;br /&gt;
 Type plot within brackets l comma  tsq comma bo.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:24&lt;br /&gt;
|Now you can see the plot&lt;br /&gt;
 Type plot within brackets l comma  tsq underscore fit comma r&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:41&lt;br /&gt;
| We get the least square fit of l versus t square.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:49&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:52&lt;br /&gt;
| In this tutorial, we have learnt to, 1. Generate a least square fit using matrices.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:57&lt;br /&gt;
| 2. Use the function &amp;lt;tt&amp;gt;lstsq()&amp;lt;/tt&amp;gt; to generate a least square fit line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:03&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:07&lt;br /&gt;
| 1. &amp;lt;nowiki&amp;gt;What does ones underscore like 1 comma  2 comma  3 produce&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
   &amp;lt;nowiki&amp;gt;array 1 comma  1 comma  1&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
   &amp;lt;nowiki&amp;gt; 1 comma  1 comma  1&amp;lt;/nowiki&amp;gt; within square brackets.&lt;br /&gt;
   &amp;lt;nowiki&amp;gt; within square brackets 1 point 0 comma  1 point 0 comma  1 point 0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
  Error&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:25&lt;br /&gt;
| 2. The plot of &amp;lt;tt&amp;gt;u&amp;lt;/tt&amp;gt; versus &amp;lt;tt&amp;gt;v&amp;lt;/tt&amp;gt; is a bunch of scattered points that show a linear trend.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:33&lt;br /&gt;
| How do you find the least square fit line of &amp;lt;tt&amp;gt;u&amp;lt;/tt&amp;gt; versus &amp;lt;tt&amp;gt;v&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:38&lt;br /&gt;
| And will look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:42&lt;br /&gt;
| 1. The function &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;ones underscore like in 1 comma  2 comma  3&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&amp;lt;nowiki&amp;gt; will generate array 1 comma  1 comma  1.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
So that is the first questions answer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:54&lt;br /&gt;
| 2. The following set of commands will produce the least square fit line of &amp;lt;tt&amp;gt;u&amp;lt;/tt&amp;gt; versus &amp;lt;tt&amp;gt;v&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 A = array within brackets u comma  ones underscore like within brackets u.T&lt;br /&gt;
 result = lstsq  within brackets A comma  v&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;m comma  c = result within square brackets 0&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
 lst underscore line = m star u plus c&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:34&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:37&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Matrices/English-timed</id>
		<title>Python/C3/Matrices/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Matrices/English-timed"/>
				<updated>2013-01-02T11:05:37Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and welcome to the tutorial on 'Matrices'. 	 |- | 0:05 | At the end of this tutorial, you will be able to,  # Create …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and welcome to the tutorial on 'Matrices'.&lt;br /&gt;
	&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Create matrices using data.&lt;br /&gt;
# Create matrices from lists.&lt;br /&gt;
# Do basic matrix operations like addition,multiplication.&lt;br /&gt;
# Perform operations to find out the -- - inverse of a matrix. - determinant of a matrix. - eigen values and eigen vectors of a matrix. - norm of a matrix. - singular value decomposition of a matrix.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:31&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with lists&amp;quot;, &amp;quot;Getting started with arrays&amp;quot;, &amp;quot;Accessing parts of arrays&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:42&lt;br /&gt;
| Let us start our ipython interpreter with pylab loaded&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:47&lt;br /&gt;
|Type ipython hypen pylab &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:52&lt;br /&gt;
| All matrix operations are done using arrays.&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
|  0:55&lt;br /&gt;
| Thus all the operations on arrays are valid on matrices also. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:00&lt;br /&gt;
| A matrix may be created as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:02&lt;br /&gt;
|Type in the terminal m1 = array within bracket and square bracket 1 comma 2 comma 3 comma 4 hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:16&lt;br /&gt;
| Using the method &amp;lt;tt&amp;gt;shape&amp;lt;/tt&amp;gt;, we can find out the shape or size of the matrix,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:20&lt;br /&gt;
|Type m1 dot shape and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:27&lt;br /&gt;
|We can see the output&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:29&lt;br /&gt;
| Since it is a one row four column matrix it returned a tuple, one by four.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:46&lt;br /&gt;
| A list can also be converted to a matrix as follows,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:50&lt;br /&gt;
|Type l1 = within square bracket square bracket 1 comma 2 comma 3 comma 4 comma in another square bracket 5 comma 6 comma 7 comma 8 &lt;br /&gt;
 Type m2 = array within bracket 11&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:28&lt;br /&gt;
|Sorry you have to type l1 array .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:35&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:43&lt;br /&gt;
| Create a two dimensional matrix m3 of order 2 by 4 with elements 5, 6, 7, 8, 9, 10, 11, 12.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:51&lt;br /&gt;
| Switch to terminal for solution. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:54&lt;br /&gt;
| m3 can be created as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:56&lt;br /&gt;
|Type m3 = array within closing bracket within square bracket square bracket 5 comma 6 comma 7 comma 8 comma in another square bracket 9 comma 10 comma 11 comma 12&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:31&lt;br /&gt;
| Let us now move to matrix operations.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:34 &lt;br /&gt;
| We can do matrix addition and subtraction easily.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:37 &lt;br /&gt;
| m3+m2 does element by element addition, that is matrix addition. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:43 &lt;br /&gt;
| Note that both the matrices should be of the same order.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:47&lt;br /&gt;
|Type m3+m2 and hit enter so you can see the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:55&lt;br /&gt;
| Similarly,m3 minus m2 does matrix subtraction, that is element by element subtraction.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:02&lt;br /&gt;
|You can try out by typing m3 minus m2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:09&lt;br /&gt;
| Now let us try,matrix multiplication&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:13&lt;br /&gt;
|Type m3 star m2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:20&lt;br /&gt;
| Note that in arrays &amp;lt;tt&amp;gt;m3 star m2&amp;lt;/tt&amp;gt; does element wise multiplication and not matrix multiplication,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:28&lt;br /&gt;
| Matrix multiplication in matrices are done using the function &amp;lt;tt&amp;gt;dot()&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:37&lt;br /&gt;
|Type dot within bracket m3 comma m2 and hit enter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:47&lt;br /&gt;
|So we can see error value show in the command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:50&lt;br /&gt;
| Due to size mismatch, the multiplication could not be done and it returned an error.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:56&lt;br /&gt;
| Now let us see an example for matrix multiplication.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:00&lt;br /&gt;
| For doing matrix multiplication we need to have two matrices of the order n by m and m by r and the resulting matrix will be of the order n by r.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:11&lt;br /&gt;
| Thus let us first create two matrices which are compatible for multiplication.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:16&lt;br /&gt;
|Type m1.shape and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:24&lt;br /&gt;
| matrix m1 is of the shape one by four,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:28&lt;br /&gt;
| let us create another one, of the order four by two,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|So type m4 = array in closing bracket within square bracket within square bracket 1 comma 2 comma  within square bracket 3 comma 4 comma  within square bracket 5 comma 6 within square bracket comma  within square bracket 7 comma 8 &lt;br /&gt;
 Type dot within bracket m1 comma  m4&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:10&lt;br /&gt;
| Thus the &amp;lt;tt&amp;gt;dot()&amp;lt;/tt&amp;gt; function is used for matrix multiplication.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:15&lt;br /&gt;
| As we already learnt in arrays, the function &amp;lt;tt&amp;gt;identity()&amp;lt;/tt&amp;gt; which creates an identity matrix of the order n by n,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:24&lt;br /&gt;
| the function &amp;lt;tt&amp;gt;zeros()&amp;lt;/tt&amp;gt; which creates a matrix of the order m by n with all zeros,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:30&lt;br /&gt;
| the function &amp;lt;tt&amp;gt;zeros like function()&amp;lt;/tt&amp;gt; which creates a matrix with zeros with the shape of the matrix passed,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:39&lt;br /&gt;
| the function &amp;lt;tt&amp;gt;ones()&amp;lt;/tt&amp;gt; which creates a matrix of order m by n with all ones,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:47&lt;br /&gt;
| the function &amp;lt;tt&amp;gt;ones underscore like()&amp;lt;/tt&amp;gt; which creates a matrix with ones with the shape of the matrix passed;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:53&lt;br /&gt;
| all these functions can also be used with matrices.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:57&lt;br /&gt;
|So now Let us see, how to find out the transpose of a matrix we can do,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:03&lt;br /&gt;
|Type print m4&lt;br /&gt;
 m4 dot T&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:14&lt;br /&gt;
| As you saw, Matrix name dot capital T will give the transpose of a matrix&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:21&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:26&lt;br /&gt;
| Find out the Frobenius norm of inverse of a 4 by 4 matrix, the matrix being,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:33 &lt;br /&gt;
|m5 = arange  within bracket 1 comma 17 dot reshape  within bracket 4 comma 4&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:44&lt;br /&gt;
|The Frobenius norm of a matrix is defined as, the square root of the sum of the absolute squares of its elements&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:54&lt;br /&gt;
| Switch to terminal for the solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:58 &lt;br /&gt;
| Let us create the matrix m5 by using the data provided in the question&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:03&lt;br /&gt;
|Type m5 = arange  within bracket 1 comma 17.reshape within square bracket 4 comma 4&lt;br /&gt;
 print m5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:20&lt;br /&gt;
| The inverse of a matrix A, A raise to minus one, is also called the reciprocal matrix, such that A multiplied by A inverse will give 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:33&lt;br /&gt;
| The Frobenius norm of a matrix is defined as square root of sum of squares of elements in the matrix. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:41&lt;br /&gt;
| The inverse of a matrix can be found using the function &amp;lt;tt&amp;gt;inv(A)&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:47&lt;br /&gt;
| Type in the terminal im5 = inv  within bracket m5 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:57&lt;br /&gt;
| And the Frobenius norm of the matrix &amp;lt;tt&amp;gt;im5&amp;lt;/tt&amp;gt; can be found out as,&lt;br /&gt;
 sum = 0&lt;br /&gt;
&lt;br /&gt;
for each in im5 dot flatten function():&lt;br /&gt;
    sum plus= each star each&lt;br /&gt;
print sqrt  within bracket sum&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:52&lt;br /&gt;
| Thus we have successfully obtained the Frobenius norm of the matrix m5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:58&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:04&lt;br /&gt;
| Find out the infinity norm of the matrix im5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:08&lt;br /&gt;
| The infinity norm of a matrix is defined as the maximum value of sum of the absolute of elements in each row.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:16&lt;br /&gt;
| Switch to terminal for the solution&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:20&lt;br /&gt;
|sum underscore rows = within square bracket &lt;br /&gt;
for i in im5 colon&lt;br /&gt;
    sum underscore rows.append  within bracket abs  within bracket i.sum()&lt;br /&gt;
print max within square bracket sum underscore rows&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:01&lt;br /&gt;
| Well! to find out the Frobenius norm and Infinity norm we have an even easier method, and let us see that now.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:10&lt;br /&gt;
| The norm of a matrix can be found out using the method &amp;lt;tt&amp;gt;norm()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:19&lt;br /&gt;
| In order to find out the Frobenius norm of the matrix im5, we do,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:25&lt;br /&gt;
|In the terminal type norm  within bracket im5 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:34&lt;br /&gt;
| And to find out the Infinity norm of the matrix im5, we do,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:39&lt;br /&gt;
|norm within bracket im5,ord=inf&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:51&lt;br /&gt;
| This is easier when compared to the code we wrote.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  11:55&lt;br /&gt;
| Read the documentation of &amp;lt;tt&amp;gt;norm&amp;lt;/tt&amp;gt; to read up more about &amp;lt;tt&amp;gt;ord&amp;lt;/tt&amp;gt; and the possible type of norms the norm function produces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:04&lt;br /&gt;
|Now let us find out the determinant of a the matrix m5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:11 &lt;br /&gt;
|The determinant of a square matrix can be obtained by using the function &amp;lt;tt&amp;gt;det()&amp;lt;/tt&amp;gt; and the determinant of m5 can be found out as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:20&lt;br /&gt;
|So type det within bracket m5 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:26&lt;br /&gt;
| Hence we get the determinant.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:29&lt;br /&gt;
| Let us now move on to eigen vectors and eigen values&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:34&lt;br /&gt;
| The eigen values and eigen vector of a square matrix can be computed using the function &amp;lt;tt&amp;gt;eig()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;eigvals()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:46&lt;br /&gt;
| Let us find out the eigen values and eigen vectors of the matrix m5. We find them as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:53&lt;br /&gt;
|Typing eig within bracket m5 in the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:02&lt;br /&gt;
| Note that it returned a tuple of two matrices.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:06 &lt;br /&gt;
| The first element in the tuple are the eigen values and the second element in the tuple are the eigen vectors.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  13:11&lt;br /&gt;
| Thus eigen values are given by,eig  within bracket m5  within square bracket 0 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:30&lt;br /&gt;
| and the eigen vectors are given by,eig within bracket m5 within square bracket 1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:44 &lt;br /&gt;
| The eigen values can also be computed using the function &amp;lt;tt&amp;gt;eigvals()&amp;lt;/tt&amp;gt; as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:50&lt;br /&gt;
|Typing on the terminal eigvals within bracket m5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  13:58&lt;br /&gt;
| Now let us learn how to do the singular value decomposition or S V D of a matrix.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  14:06&lt;br /&gt;
| Suppose M is an m (cross) in matrix, whose entries come from the field K, which is either the field of real numbers or the field of complex numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  14:18&lt;br /&gt;
| Then there exists a factorization of the form&lt;br /&gt;
&lt;br /&gt;
M = USigma V star&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  14:25&lt;br /&gt;
| where U is an (m by m) unitary matrix over K, the matrix Sigma is an (m by n) diagonal matrix and with non-negative real numbers on the diagonal, and V* is an (n by n) unitary matrix over K,which denotes the conjugate transpose of V.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  14:53&lt;br /&gt;
| Such a factorization is called the singular-value decomposition of M.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:58&lt;br /&gt;
| The SVD of matrix m5 can be found as&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:01&lt;br /&gt;
|So now open the terminal and type svd within brackets m5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:09&lt;br /&gt;
| Notice that it returned a tuple of 3 elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:12&lt;br /&gt;
| The first one U the next one Sigma and the third one V star&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:19&lt;br /&gt;
| This brings us to the end of the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:22 &lt;br /&gt;
| In this tutorial, we have learnt to, 1. Create matrices using arrays.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:25&lt;br /&gt;
| 2. Add,subtract and multiply the elements of matrix.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:28&lt;br /&gt;
| 3. Find out the inverse of a matrix,using the function &amp;lt;tt&amp;gt;inv()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:32&lt;br /&gt;
| 4. Use the function &amp;lt;tt&amp;gt;det()&amp;lt;/tt&amp;gt; to find the determinant of a matrix.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:36&lt;br /&gt;
| 5. Calculate the norm of a matrix using the for loop and also using the function &amp;lt;tt&amp;gt;norm()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:43&lt;br /&gt;
| 6. Finding out the eigen vectors and eigen values of a matrix, using functions &amp;lt;tt&amp;gt;eig()&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;eigvals()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:50&lt;br /&gt;
| 7. Calculate singular value decomposition(SVD) of a matrix using the function &amp;lt;tt&amp;gt;svd()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:58&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  16:01&lt;br /&gt;
| 1. A and B are two array objects. Element wise multiplication in matrices are done by,&lt;br /&gt;
    A * B&lt;br /&gt;
   &amp;lt;tt&amp;gt;multiply within bracket A comma  B&amp;lt;/tt&amp;gt;&lt;br /&gt;
   &amp;lt;tt&amp;gt;dot within bracket A comma  B&amp;lt;/tt&amp;gt;&lt;br /&gt;
   &amp;lt;tt&amp;gt;element underscore multiply within bracket A comma B&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  16:19&lt;br /&gt;
| 2. &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;eig within bracket A within square bracket 1&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;eigvals within bracket A&amp;lt;/tt&amp;gt; are the same.Is it  True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  16:31&lt;br /&gt;
| 3. &amp;lt;tt&amp;gt;norm  within bracket A comma ord= within is equal to fro&amp;lt;/tt&amp;gt; is the same as &amp;lt;tt&amp;gt;norm within bracket A&amp;lt;/tt&amp;gt;. Is it True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:43&lt;br /&gt;
| Look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  16:47&lt;br /&gt;
| 1. Element wise multiplication between two matrices, A and B is done as, A into B&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:53&lt;br /&gt;
| 2. False. &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;eig within bracket A within square bracket 0&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;eigvals  within bracket A&amp;lt;/tt&amp;gt; are same, that is both will give the eigen values of matrix A.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  17:06&lt;br /&gt;
|3. &amp;lt;tt&amp;gt;norm within bracket A comma ord=is equal to fro&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;norm(A)&amp;lt;/tt&amp;gt; are same, since the order=is equal to fro stands for Frobenius norm.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:22&lt;br /&gt;
| Hence answer is true.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:26&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17:30&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Accessing-parts-of-arrays/English-timed</id>
		<title>Python/C3/Accessing-parts-of-arrays/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Accessing-parts-of-arrays/English-timed"/>
				<updated>2013-01-02T11:04:40Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:00 | Hello friends and Welcome to the tutorial on 'Accessing pieces of arrays'.  |- | 0:05 | At the end of this tutorial, you will be ab…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and Welcome to the tutorial on 'Accessing pieces of arrays'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Access and change individual elements of arrays, both one dimensional and multi-dimensional.&lt;br /&gt;
# Access and change rows and columns of arrays.&lt;br /&gt;
# Access and change other chunks from an array, using slicing and striding.&lt;br /&gt;
# And read images into arrays and perform processing on them, using simple array manipulations.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:32&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with arrays&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:40&lt;br /&gt;
| Now open the terminal and type ipython hypen pylab&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:50&lt;br /&gt;
| Let us begin with the help of an example. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:54&lt;br /&gt;
|Let us have two arrays, A and C, as the sample arrays that we will use to work through this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:08&lt;br /&gt;
|Let us begin with the most elementary thing, accessing individual elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:14&lt;br /&gt;
| Also, let us first do it with the one-dimensional array A, and then do the same thing with the two-dimensional array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:30&lt;br /&gt;
|Type A = array within bracket square bracket 12 comma 23 coma 34 comma 45 comma 56  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:45&lt;br /&gt;
|C = array within bracket square bracket 11 comma 12 comma 13 comma 14 comma 15 comma &lt;br /&gt;
           within square bracket 21 to 25 comma &lt;br /&gt;
           within square bracket 31 to 35 comma &lt;br /&gt;
           within square bracket 41 to 45 comma &lt;br /&gt;
           within square bracket 51 to 55 then close the bracket and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:36&lt;br /&gt;
| To access, the element 34 in array A, we say, A of 2, note that we are using square brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:44&lt;br /&gt;
|So type A within square bracket and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:51&lt;br /&gt;
| Like lists, indexing starts from 0 in arrays, too. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:56&lt;br /&gt;
| So, 34, the third element has the index 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:03&lt;br /&gt;
| Now, let us access the element 34 from C.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:06&lt;br /&gt;
| To do this, we say, C of 2,3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:11&lt;br /&gt;
|So type C within square bracket 2 comma 3 and hit enter &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:18 &lt;br /&gt;
| 34 is in the third row and the fourth column, and since indexing begins from zero, the row index is 2 and column index is 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:31&lt;br /&gt;
| Now, that we have accessed one element of the array,let us change it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:38&lt;br /&gt;
| We shall change 34 to minus 34 in both A and C.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:43&lt;br /&gt;
| To do this, we simply assign the new value after accessing the element.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:47&lt;br /&gt;
|So type A within square bracket 2 = minus 34 and for C type C within square bracket 2 comma 3 = minus 34&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:06&lt;br /&gt;
| Let us check our operations,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:11&lt;br /&gt;
|So type A within square bracket 2  hit enter and C within square bracket 2 comma 3&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:21&lt;br /&gt;
| Now that we have accessed and changed a single element,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:25&lt;br /&gt;
| let us access and change more than one element at a time; first rows and then columns.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:31&lt;br /&gt;
| Let us access one row of C, say the third row&lt;br /&gt;
|-&lt;br /&gt;
| 4:35&lt;br /&gt;
| We do it by saying,C within square bracket 2 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:47&lt;br /&gt;
| How do we access the last row of C? We could say,so type C within square bracket 4 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:59&lt;br /&gt;
| or as with lists,we could use negative indexing and say,C within bracket -1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:11&lt;br /&gt;
| Now, we could change the last row into all zeros, using either C within square bracket -1 =  within square bracket five zeros and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:31&lt;br /&gt;
| or, we can use,C within square bracket -1=0&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:45&lt;br /&gt;
| Now, how do we access one column of C? &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:50&lt;br /&gt;
| As with accessing individual elements, the column is the second parameter to be specified (after comma). &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:58&lt;br /&gt;
| The first parameter, is replaced with a semi colon a colon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:05&lt;br /&gt;
|  This specifies that we want all the elements of that dimension, instead of just one particular element. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:12&lt;br /&gt;
| We access the third column by saying,type C within square bracket colon comma 2 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:24&lt;br /&gt;
| Pause the video here,try out the following exercise. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:34&lt;br /&gt;
| Change the last column of C to zeros.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:39&lt;br /&gt;
| Switch to the terminal for solution. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:44&lt;br /&gt;
| To change the entire last column of C to zeros, we simply say,&lt;br /&gt;
C within square bracket colon comma minus -1 = 0 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:04&lt;br /&gt;
| Since A is one dimensional, rows and columns of A don't make much sense. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:09&lt;br /&gt;
| It has just one row and A of colon gives the whole of A.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:15&lt;br /&gt;
|So type A within square bracket colon and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:21&lt;br /&gt;
|Now pause the video here,try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:30&lt;br /&gt;
| Change &amp;lt;tt&amp;gt;A&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[11, 12, 13, 14, 15]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:38&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:42&lt;br /&gt;
|  To change A, we say,A within square bracket colon = within square bracket 11 comma 12 comma 13 comma 14 comma 15 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:06&lt;br /&gt;
| Now, that we know how to access, rows and columns of an array, &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:13&lt;br /&gt;
| we shall learn how to access other pieces of an array. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:15&lt;br /&gt;
| For this purpose, we will be using image arrays.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:19&lt;br /&gt;
| To read an image into an array, we use the &amp;lt;tt&amp;gt;imread&amp;lt;/tt&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:25&lt;br /&gt;
| We shall use the image &amp;lt;tt&amp;gt;squares dot png&amp;lt;/tt&amp;gt; present in &amp;lt;tt&amp;gt;slash home slash fossee&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:32&lt;br /&gt;
| We first navigate to that path in the OS and see what the image contains.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:42&lt;br /&gt;
| Let us now read the data in &amp;lt;tt&amp;gt;squares dot png&amp;lt;/tt&amp;gt; into the array &amp;lt;tt&amp;gt;I&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:48&lt;br /&gt;
|Type I=imread within bracket in single quote slash home slash fossee slash squares dot png&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:07&lt;br /&gt;
| We can see the contents of the image, using the command &amp;lt;tt&amp;gt;imshow&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:13&lt;br /&gt;
|We say, imshow within bracket I to see what has been read into &amp;lt;tt&amp;gt;I&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:19&lt;br /&gt;
|So type imshow within bracket I and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:26&lt;br /&gt;
| We do not see white and black because, &amp;lt;tt&amp;gt;pylab&amp;lt;/tt&amp;gt; has mapped white and black to different colors. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:33&lt;br /&gt;
| This can be changed by using a different color map.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:37&lt;br /&gt;
| To see that &amp;lt;tt&amp;gt;I&amp;lt;/tt&amp;gt; is really, just an array, we say, I, at the prompt,so type I&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:47&lt;br /&gt;
| We see that an array is displayed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:50&lt;br /&gt;
| To check the dimensions of any array, we can use &amp;lt;tt&amp;gt;dotshape&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:55&lt;br /&gt;
|So type I dot shape&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:00&lt;br /&gt;
| As we can see,we got the dimensions of the image.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:04&lt;br /&gt;
| The image,``squares dot png`` has the dimensions of 300x300.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:11&lt;br /&gt;
| Our goal for this part of the tutorial would be to get the top-left quadrant of the image.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:17&lt;br /&gt;
| To do this, we need to access, a few of the rows and a few of the columns of the array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:24&lt;br /&gt;
| To access, the third column of C, we said, &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;C with square brackets colon dot 2&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:33&lt;br /&gt;
| Essentially, we are accessing all the rows in column three of C. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:40&lt;br /&gt;
| Now, let us modify this to access only the first three rows, of column three of C.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:46&lt;br /&gt;
| We say,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:51&lt;br /&gt;
| C within square bracket 0 colon 3 comma 2 gives, the elements of rows indexed from 0 to 3, 3 not included and column indexed 2. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:06&lt;br /&gt;
| Note that, the index before the colon is included and the index after it is not included in the slice that we have obtained.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:16&lt;br /&gt;
| This is very similar to the &amp;lt;/nowiki&amp;gt;&amp;lt;tt&amp;gt;range&amp;lt;/tt&amp;gt; function, where &amp;lt;tt&amp;gt;range&amp;lt;/tt&amp;gt; returns a list, in which the upper limit or stop value is not included.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:26&lt;br /&gt;
|So type C within square bracket 0 colon 3 comma 2 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  11:37&lt;br /&gt;
| Now, if we wish to access the elements of row with index 2, and in columns indexed 0 to 2 (included), we say,&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:48&lt;br /&gt;
|So type C within square bracket 2 comma 0 colon 3 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:02&lt;br /&gt;
| Pause the video here, try out the exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:09&lt;br /&gt;
| First, obtain the elements [22, 23] from C. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:17&lt;br /&gt;
| Then, obtain the elements [11, 21, 31, 41] from C. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:23&lt;br /&gt;
| And then the third one and Final one, obtain the elements [21,31, 41, 0]. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:32&lt;br /&gt;
| Now switch to the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:38&lt;br /&gt;
|So type C within square bracket 1 comma 1 colon 3 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:47&lt;br /&gt;
| C[1, 1 is to  3] gives the elements [22, 23].&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:57&lt;br /&gt;
| C within square bracket 0 colon 4 comma 0 gives the elements [11, 21, 31, 41].&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:15&lt;br /&gt;
| C[1 colon 5, 0] gives the elements [21, 31, 41, 0].&lt;br /&gt;
|-&lt;br /&gt;
| 13:24&lt;br /&gt;
| Note that when specifying ranges, if you are starting from the beginning or going up-to the end, the corresponding element may be dropped. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:32&lt;br /&gt;
| So, in the previous example to obtain [11, 21, 31, 41], we could have simply said,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:39&lt;br /&gt;
|So type C within square bracket 1 colon 5 comma 0 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:50&lt;br /&gt;
| We get the elements [21, 31, 41, 0]. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:55&lt;br /&gt;
| If we skip both the indexes, we get the slice from end to end, as we already know.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:02&lt;br /&gt;
|So type C within square bracket colon 4 comma 0 and hit enter&lt;br /&gt;
So type C within square bracket 1 colon comma 0 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:16&lt;br /&gt;
|Now pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:21&lt;br /&gt;
| Obtain the elements [[23, 24] comma  [33, -34]] from C.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:29&lt;br /&gt;
|Now switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:32&lt;br /&gt;
| Type the command&amp;lt;nowiki&amp;gt;C within square bracket 1 colon 3 comma 2 colon 4 will give us the required elements.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:44&lt;br /&gt;
| Now, we wish to obtain the top left quarter of the image. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:50&lt;br /&gt;
| How do we go about doing it?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:54&lt;br /&gt;
| Since, we know the shape of the image is 300, we know that we need to get the first 150 rows and the first 150 columns.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:04&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;I[colon 150 comma colon 150] gives us the top-left corner of the image.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:12&lt;br /&gt;
|So type I within square bracket colon 150 comma colon 150 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  15:28&lt;br /&gt;
| We use the &amp;lt;tt&amp;gt;imshow&amp;lt;/tt&amp;gt; command to see the slice we obtained in the form of an image and confirm.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:36&lt;br /&gt;
|So type imshow within bracket I within square bracket colon 150 comma colon 150 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:58&lt;br /&gt;
|Obtain the square in the center of the image.With the exercise that we are about to do.So please Pause the video here&lt;br /&gt;
|-&lt;br /&gt;
| 16:14&lt;br /&gt;
| Now switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  16:16&lt;br /&gt;
| Type the command. Hence, we get the center of the image.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:20&lt;br /&gt;
| Our next goal is to compress the image, using a very simple technique.&lt;br /&gt;
&lt;br /&gt;
|- &lt;br /&gt;
|16:27&lt;br /&gt;
|So type imshow within bracket I and with square bracket 75 colon 225 comma 75 colon 225 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:53&lt;br /&gt;
| The idea is to drop alternate rows and columns of the image and save it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:01&lt;br /&gt;
|  This way we will be reducing the data to one-fourth of the original data but losing only a little of visual information.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:07&lt;br /&gt;
|We shall first learn the idea of striding using the smaller array C. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:12&lt;br /&gt;
| Suppose we wish to access only the odd rows and columns (first, third, fifth). &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:19&lt;br /&gt;
| We do this by,Typing C within square bracket 0 colon 5 colon 2 comma 0 colon 5 colon 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:36&lt;br /&gt;
| if we wish to be explicit, then we say,C colon colon 2 with square bracket in colon colon 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:52&lt;br /&gt;
| This is very similar to the step specified in the &amp;lt;tt&amp;gt;range&amp;lt;/tt&amp;gt; function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:56&lt;br /&gt;
| It specifies, the jump or step in which to move, while accessing the elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:00&lt;br /&gt;
| If no step is specified, a default value of 1 is assumed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:05&lt;br /&gt;
|Type C with square bracket  1 colon colon 2 comma colon colon 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:18&lt;br /&gt;
| we get the elements, [[21, 23, 0] comma [41, 43, 0]] &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:25&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:31&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;Obtain the following. [[12, 0],[42, 0]]then in bracket [[12, 13, 14], [0, 0, 0]]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:43&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:47&lt;br /&gt;
| Now, that we know how to stride over an array,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:50&lt;br /&gt;
|  we can drop alternate rows and columns out of the image in I.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:55&lt;br /&gt;
| To see this image, we say,I within square bracket  colon colon 2 comma colon colon 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:09&lt;br /&gt;
| Then does not have much data to notice any real difference, but notice that the scale has reduced to show that we have dropped alternate rows and columns. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:18&lt;br /&gt;
| If you notice carefully, you will be able to observe some blurring near the edges. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:22&lt;br /&gt;
| To notice this effect more clearly, increase the step to 4.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:27&lt;br /&gt;
|So type imshow within bracket I with square bracket  colon colon 2 comma colon colon 2 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:47&lt;br /&gt;
|Then type imshow then within bracket colon colon 4 and a name colon colon 4 It can also be replaced by previous command given.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:07&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:10&lt;br /&gt;
| In this tutorial, we have learnt to, 1.Manipulate single &amp;amp; multi dimensional arrays.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:14&lt;br /&gt;
| 2.Access and change individual elements by using their index numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:19&lt;br /&gt;
| 3.Access and change rows and columns of arrays by specifying the row and column numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:24&lt;br /&gt;
| 4.Slice and stride on arrays.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:26&lt;br /&gt;
| 5.Read images into arrays and manipulate them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:29&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:33&lt;br /&gt;
| 1.Given the array, &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;A = array([12, 15, 18, 21])&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;, how do we access the element &amp;lt;tt&amp;gt;18&amp;lt;/tt&amp;gt;?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:44&lt;br /&gt;
| 2. Given the array,&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;B = array([[10, 11, 12, 13],&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
            &amp;lt;nowiki&amp;gt;[20, 21, 22, 23],&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
            &amp;lt;nowiki&amp;gt;[30, 31, 32, 33],&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
            &amp;lt;nowiki&amp;gt;[40, 41, 42, 43]])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:52&lt;br /&gt;
| Obtain the elements, &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;[[21, 22] comma [31, 32]]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:58&lt;br /&gt;
| 3. Given the array,&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;C = array([[10, 11, 12, 13],&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
            &amp;lt;nowiki&amp;gt;[20, 21, 22, 23]])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:05&lt;br /&gt;
| Change the array to&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;C = array([[10, 11, 10, 11],&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
            &amp;lt;nowiki&amp;gt;[20, 21, 20, 21]])&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:14&lt;br /&gt;
| And lets look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:18&lt;br /&gt;
| 1.The element 18 in array A has index number 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:25&lt;br /&gt;
| Hence, we access it as A of 2,answer is A in square bracket 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:33&lt;br /&gt;
| 2. To obtain the center four numbers in the array B, we say,B of 1 colon 3 comma 1 colon 3&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:43&lt;br /&gt;
| 3. We can change the elements of array C,by using slicing and striding&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;B[colon 2, 2 colon] = B[colon 2, colon 2]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 21:58&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 22:02&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-arrays/English-timed</id>
		<title>Python/C3/Getting-started-with-arrays/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-arrays/English-timed"/>
				<updated>2013-01-02T11:02:36Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello friends and welcome to the spoken tutorial on 'Getting started with arrays'.  |- | 0:06 | At the end of this tutorial, you wi…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and welcome to the spoken tutorial on 'Getting started with arrays'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Create arrays using data.&lt;br /&gt;
# Create arrays from lists.&lt;br /&gt;
# Perform basic array operations.&lt;br /&gt;
# Create identity matrix.&lt;br /&gt;
# Use functions zeros(), zeros underscore like(), ones(), ones underscore like().&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:26&lt;br /&gt;
| So Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Lists&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:35&lt;br /&gt;
| Arrays are homogeneous data structures.&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
| 0:39&lt;br /&gt;
|Unlike lists, arrays cannot have heterogeneous data elements. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:45&lt;br /&gt;
|They can have only one type of data as their entries, be them all integers, strings, or maybe floats, but not a mix.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:55&lt;br /&gt;
|Arrays of a given length are comparatively much faster in mathematical operations than lists of the same length, because of the fact that they are homogeneous data structures.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:07&lt;br /&gt;
|Let us see how to create arrays.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:11&lt;br /&gt;
| Run your IPython interpreter with &amp;lt;tt&amp;gt;space hypen pylab&amp;lt;/tt&amp;gt; option, to load the required modules to work with arrays.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:21&lt;br /&gt;
|So type ipyhton space hypen pylab&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:28&lt;br /&gt;
| To create an array we will use the function &amp;lt;tt&amp;gt;array()&amp;lt;/tt&amp;gt; as,a1 = array within brackets square brackets 1 comma 2 comma 3 comma 4  &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:45&lt;br /&gt;
| Notice that we created a one dimensional array here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:49&lt;br /&gt;
| Also notice that the object we passed to create an array is a list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:54&lt;br /&gt;
|Now let us see how to create a two dimensional array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:58&lt;br /&gt;
|We create two dimensional array by converting a list of lists to an array as,&lt;br /&gt;
a2 = array within brackets within square brackets 1 comma 2 comma 3 comma 4  comma then again within square brackets 5 comma 6 comma 7 comma 8 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:38&lt;br /&gt;
| Now let us use &amp;lt;tt&amp;gt;arange()&amp;lt;/tt&amp;gt; function to create the same array as before.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:45&lt;br /&gt;
|For that type ar = arange within bracket 1 comma 9 and hit enter,so type &lt;br /&gt;
print ar to get the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:02&lt;br /&gt;
| So now, As you can see, we obtained a one dimensional array with elements from 1 to 8.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:12&lt;br /&gt;
|Now can we make it a two dimensional array of order 2 by 4? Yes,we can.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:20&lt;br /&gt;
|For this we will have to use the function &amp;lt;tt&amp;gt;reshape()&amp;lt;/tt&amp;gt;,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:24&lt;br /&gt;
|So type ar.reshape brackets  2 comma 4 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:33&lt;br /&gt;
|So type ar.reshape within brackets 4 comma 2&lt;br /&gt;
then  ar = ar dot reshape within brackets 2,4 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:55&lt;br /&gt;
| Hence,we got our two-dimensional array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:58&lt;br /&gt;
|Now, let us see how to convert a list object to an array. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:02&lt;br /&gt;
|We define a list,say l1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:07&lt;br /&gt;
|So type l1 = within square brackets 1 comma 2 comma 3 comma 4 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:16&lt;br /&gt;
| Now to convert this list to an array,we use the array function as, a3 = array within brackets l1 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:30&lt;br /&gt;
| To find the shape of an array we can use the method &amp;lt;tt&amp;gt;dot shape&amp;lt;/tt&amp;gt;, &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:36&lt;br /&gt;
|let us check the shape of the arrays we have created so far,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:44&lt;br /&gt;
| &amp;lt;tt&amp;gt;a2 dot shape&amp;lt;/tt&amp;gt; object is a tuple, and it returned a tuple (2 comma 4).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:52&lt;br /&gt;
|A tuple is nothing but an ordered list of elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:56&lt;br /&gt;
|So Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:12&lt;br /&gt;
| Find out the shape of the other arrays i.e. a1 comma a3 comma ar that we have created.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:22&lt;br /&gt;
|It can be done as&lt;br /&gt;
a1 dot shape&lt;br /&gt;
a3 dot shape&lt;br /&gt;
ar dot shape in the terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:37&lt;br /&gt;
| Now let us try to create a new array with a mix of elements and see what will happen,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:45&lt;br /&gt;
|So type a4 = array within brackets then square bracket 1 comma 2 comma 3 comma and single quote a string and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:07&lt;br /&gt;
| Well, we would expect an error as it has been previously mentioned that arrays handle elements with the same datatype, but it didn't raise an error. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:16&lt;br /&gt;
|Let us check the values in the new array created. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:19&lt;br /&gt;
|So Type a4 in the terminal,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:27&lt;br /&gt;
| Did you notice it, all the elements have been implicitly type casted as strings, though our first three elements were meant to be integers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:37&lt;br /&gt;
| Also,if you have noticed,we got something like 'dtype S8' in the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:44&lt;br /&gt;
| dtype is nothing but the datatype which is the minimum type required to hold the objects in the sequence.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:52&lt;br /&gt;
| Let us now move on to study functions like zeros() function and ones() function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:59&lt;br /&gt;
|For this ,we will have to create a matrix. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:02&lt;br /&gt;
|let us see how to create an identity matrix of a given size, this is a two-dimensional array in which all the diagonal elements are ones and rest of the elements are zeros. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:13&lt;br /&gt;
|We can create an identity matrix using the function &amp;lt;tt&amp;gt;identity()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:18&lt;br /&gt;
|The function &amp;lt;tt&amp;gt;identity()&amp;lt;/tt&amp;gt; takes an integer argument which specifies the size of the desired matrix,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:27&lt;br /&gt;
| As you can see the identity function returned a three by three square matrix with all the diagonal elements as one and the rest of the elements as zeros.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:43&lt;br /&gt;
|So type identity within brackets 3&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:48&lt;br /&gt;
|&amp;lt;tt&amp;gt;zeros()&amp;lt;/tt&amp;gt; function accepts a tuple, which is the order of the array that we want to create, and it generates an array with all elements as zeros.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:59&lt;br /&gt;
|Let us create an array of the order four by five with all the elements zero.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:06&lt;br /&gt;
| We can do it using the method zeros(),&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:10&lt;br /&gt;
|So type zeros within brackets then again in bracket 4 comma 5 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:21&lt;br /&gt;
| Notice that we passed a tuple to the function zeros. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:25&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:33&lt;br /&gt;
|So now we learnt two functions identity and zeros&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:38&lt;br /&gt;
| '''Find out about the functions'''&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:41&lt;br /&gt;
| zeros underscore like()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:43&lt;br /&gt;
| ones()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:44&lt;br /&gt;
| ones underscore like()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:48&lt;br /&gt;
| Try the following, first check the value of a1,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:52&lt;br /&gt;
| We see that &amp;lt;tt&amp;gt;a1&amp;lt;/tt&amp;gt; is a single dimensional array,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:56&lt;br /&gt;
|So type a1 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:01&lt;br /&gt;
| So next  now try a1 into 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:05&lt;br /&gt;
|So type a1 into 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  9:09&lt;br /&gt;
| It returned a new array with all the elements multiplied by 2. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:13&lt;br /&gt;
|Now let us again check the contents of a1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:19&lt;br /&gt;
| note that the value of a1 still remains the same.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:23&lt;br /&gt;
|Similarly with addition,so type a1 plus 2 and hit enter and then type a1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:36&lt;br /&gt;
| it returns a new array, with all the elements summed with two. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:41&lt;br /&gt;
|But again notice that the value of a1 has not been changed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:46&lt;br /&gt;
|You may change the value of a1 by simply assigning the newly returned array as,a1 space plus=2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:03&lt;br /&gt;
| Notice the change in elements of a by typing 'a' so type a and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:13&lt;br /&gt;
|so type a1 to get the output&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:18&lt;br /&gt;
| We can use all the mathematical operations with arrays,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:22&lt;br /&gt;
| Now let us try this a1 = array within brackets square brackets 1 comma 2 comma 3 comma 4&lt;br /&gt;
and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:45&lt;br /&gt;
|then a2 = array within brackets square brackets 1 comma 2 comma 3 comma 4&lt;br /&gt;
then type a1 + a2&lt;br /&gt;
and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  11:07&lt;br /&gt;
| This returns an array with element by addition&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:15&lt;br /&gt;
|So try out a1 into a2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:23&lt;br /&gt;
| a1 into a2 returns an array with element by element multiplication,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:31&lt;br /&gt;
|And notice that it does not perform matrix multiplication.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:37&lt;br /&gt;
| This brings us to the end of the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:41&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
1. Create an array using the &amp;lt;tt&amp;gt;array()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:46&lt;br /&gt;
| 2. Convert a list to an array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:49&lt;br /&gt;
| 3. Perform some basic operations on arrays like addition,multiplication.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:53&lt;br /&gt;
| 4. Use functions like - .shape - arrange() - .reshape - zeros() &amp;amp; zeros underscore like() - ones() &amp;amp; ones underscore like()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:05&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
| 12:09&lt;br /&gt;
|1.First one, &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;x = array within brackets square bracket 1 comma 2 comma 3 comma square bracket 5 comma 6 comma 7&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; is a valid statement&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:23&lt;br /&gt;
| So IS True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:27&lt;br /&gt;
| 2. What does the &amp;lt;tt&amp;gt;ones underscore like()&amp;lt;/tt&amp;gt; function do?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:31&lt;br /&gt;
| A. Returns an array of ones with the same shape and type as a given array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:37&lt;br /&gt;
|B. Return a new array of given shape and type, filled with ones.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:43&lt;br /&gt;
| Now Read the statements and answer,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:47&lt;br /&gt;
| Only statement A is correct.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:49&lt;br /&gt;
| Only statement B is correct.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:51&lt;br /&gt;
| Both statement A and B are correct.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:53&lt;br /&gt;
| Both statement A and B are incorrect.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:56&lt;br /&gt;
| So And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:59&lt;br /&gt;
|1. The answer is False.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:02&lt;br /&gt;
| The correct way would be to assign the elements as a list of lists and then convert it to an array&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:10&lt;br /&gt;
|Type &amp;lt;nowiki&amp;gt;x = array within brackets square brackets 1 comma 2 comma 3 comma square brackets 5 comma 6 comma 7&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:21&lt;br /&gt;
| 1. The function &amp;lt;tt&amp;gt;ones underscores like()&amp;lt;/tt&amp;gt; returns an array of ones with the same shape and type as a given array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:29&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:31&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Statistics/English-timed</id>
		<title>Python/C3/Statistics/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Statistics/English-timed"/>
				<updated>2013-01-02T11:01:22Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and welcome to the tutorial on 'Statistics' using Python.  |- | 0:06 | At the end of this tutorial,you will be able to,  …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to the tutorial on 'Statistics' using Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial,you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Do statistical operations in Python&lt;br /&gt;
# Sum a set of numbers&lt;br /&gt;
# Find their mean,median and standard deviation&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:17&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:21&lt;br /&gt;
|&amp;quot;Loading Data from files&amp;quot; &amp;quot;Getting started with Lists&amp;quot; and  &amp;quot;Accessing Pieces of Arrays&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:29 &lt;br /&gt;
| Now, type in terminal ipython space hyphen pylab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:38 &lt;br /&gt;
| For this tutorial, we will use data file that is at the path slash home slash fossee slash sslc2 dot txt. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:47&lt;br /&gt;
|It contains record of students and their performance in one of the State Secondary Board Examination. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:53&lt;br /&gt;
|It has 180,000 lines of record. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:57&lt;br /&gt;
|We are going to read it and process this data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:02&lt;br /&gt;
| We can see the content of file by double clicking on it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:06&lt;br /&gt;
|It might take some time to open since it is quite a large file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:11&lt;br /&gt;
| Please don't edit the data since it has a particular structure.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:15&lt;br /&gt;
| To check the contents of the file, we use the cat command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:18&lt;br /&gt;
| So type cat space slash home slash fossee slash sslc2 dot txt. Hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:31&lt;br /&gt;
| Each line in the file is a set of 11 fields separated by semi-colons.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:38&lt;br /&gt;
| Consider a sample line from this file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:43&lt;br /&gt;
| A semicolon 015163 semicolon JOSEPH RAJ S semicolon 083 semicolon 042 semicolon 47 semicolon 00 semicolon 72 semicolon 244 and three semicolons in a row.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:11&lt;br /&gt;
|The following are the fields in any given line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:16&lt;br /&gt;
| * Region Code which is 'A' * Roll Number 015163 * Name JOSEPH RAJ S * Marks of 5 subjects: ** English 083 ** Hindi 042 ** Maths 47 **&lt;br /&gt;
Science 35  **Social Science 72 and Total marks 244&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:42&lt;br /&gt;
| Lets load this data as an array and then run various functions on it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:48&lt;br /&gt;
|To get the data as an array, we use the loadtxt command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:53&lt;br /&gt;
|So type on the terminal L is equal to loadtxt within brackets , single quotes slash home slash fossee slash sslc2 dot txt comma usecols is equal to within brackets 3,4,5,6,7 comma delimiter is equal to within single quotes semicolon) and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:45&lt;br /&gt;
| We get our output in the form of an array dot loadtxt function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:57&lt;br /&gt;
|Now we have an error.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:58&lt;br /&gt;
|We have to type loadtxt before the brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:09&lt;br /&gt;
| Delimiter specifies the kind of character, that the fields of data separated by usecols specifies the columns to be used.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:19&lt;br /&gt;
| So within brackets 3,4,5,6,7 loads those columns. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:26&lt;br /&gt;
|The 'comma' is added because usecols is a sequence.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:31&lt;br /&gt;
|As we can see L is an array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:35&lt;br /&gt;
| We can get the shape of this array using in the terminal we can type L dot shape and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:43&lt;br /&gt;
| We get a tuple stating the numbers of rows and columns respectively. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:50&lt;br /&gt;
|Lets start applying statistical operations on these. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:55&lt;br /&gt;
|We will start with the most basic, summing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:59&lt;br /&gt;
| How do you find the sum of marks of all subjects for the first student.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:04&lt;br /&gt;
| As we know from our knowledge of accessing pieces of arrays, to access the first row, we will do in terminal type L square brackets 0 comma colon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:19&lt;br /&gt;
| Now to sum this we can say totalmarks is equal to sum within brackets L within square brackets 0 comma colon. Hit Enter.Then totalmarks. Then again Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:47&lt;br /&gt;
| Now to get the mean we can divide the totalmarks by the length.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:52&lt;br /&gt;
|So type totalmarks slash len within brackets L in square brackets 0 comma colon.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:10 &lt;br /&gt;
|Or simply use the function mean.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:13&lt;br /&gt;
|For that type mean within brackets L and in square brackets 0 comma colon and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:31&lt;br /&gt;
| But we have such a large data set and calculating the mean for each student one by one is impossible.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:38&lt;br /&gt;
| Is there a way to reduce the work.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:40&lt;br /&gt;
|For this we will look into the documentation of mean&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:42&lt;br /&gt;
|So for that type mean question mark in the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:49&lt;br /&gt;
| As we know L is a two dimensional array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:52&lt;br /&gt;
| We can calculate the mean across each of the axis of the array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:57&lt;br /&gt;
| The axis of rows is referred by number 0 and columns by 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:02&lt;br /&gt;
| So to calculate mean across all columns, we will pass extra parameter 1 for the axis.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:07&lt;br /&gt;
|So type mean within brackets L comma 1 and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:17&lt;br /&gt;
| L here, is a two dimensional array.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:20&lt;br /&gt;
|Similarly to calculate average marks scored by all the students for each subject can be calculated using mean within brackets L comma 0.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:36&lt;br /&gt;
| Next, let us calculate the median of English marks for the all the students.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:41&lt;br /&gt;
| We can access English marks of all students using L in square brackets colon comma zero and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:53&lt;br /&gt;
| To get the median we will simply use the function &amp;lt;tt&amp;gt;median&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:57&lt;br /&gt;
|So type median within brackets L square brackets colon comma 0 .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:17&lt;br /&gt;
| For all the subjects we can use the same syntax as mean and calculate median across all rows using median&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:25&lt;br /&gt;
|So type median in brackets L comma 0 and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:35&lt;br /&gt;
| Similarly to calculate standard deviation for English we will use the function &amp;lt;tt&amp;gt;std&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:41&lt;br /&gt;
|So type std, in brackets L and in square brackets colon comma 0 and hit Enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:57&lt;br /&gt;
| and for all rows, we do std within brackets L comma 0.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:08&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:13&lt;br /&gt;
| In the given file football dot txt at path slash home slash fossee slash football dot txt , one column is player name,second is goals at home and third goals away.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:28&lt;br /&gt;
|1.Find the total goals for each player&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:33&lt;br /&gt;
| 2.Mean of home and away goals &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:37&lt;br /&gt;
|3.Standard deviation of home and away goals&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:46&lt;br /&gt;
| This is the required data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:49&lt;br /&gt;
|For that open the football dot txt file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:54&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:00&lt;br /&gt;
| This brings us to the end of the tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:03&lt;br /&gt;
| In this tutorial,we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:07&lt;br /&gt;
|1. Do the standard statistical operations sum , mean median and standard deviation in Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:14&lt;br /&gt;
|2. Combine text loading and the statistical operation to solve real world problems.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:24&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:27&lt;br /&gt;
|1. &amp;lt;nowiki&amp;gt;Given a two dimensional list, two_dimensional_list is equal to within square brackets [3,5,8,2,1],within another square brackets [4,3,6,2,1] how do we calculate the mean of each row?&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:49&lt;br /&gt;
| 2.&amp;lt;nowiki&amp;gt;Calculate the median of the given list? student_marks is equal to within square brackets 74,78,56,87,91,82&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:03&lt;br /&gt;
|And the third question is Suppose there is a file with 6 columns but we wish to load text only in columns 2,3,4,5. How do we specify that?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:16&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:20&lt;br /&gt;
|1. To get the mean of each row, we just pass 1 as the second parameter to the function &amp;lt;tt&amp;gt;mean&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:29&lt;br /&gt;
| So we have to type mean within brackets two_dimensional_list comma 1&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:37&lt;br /&gt;
|2. We use the function &amp;lt;tt&amp;gt;median&amp;lt;/tt&amp;gt; to calculate the median of the list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:42&lt;br /&gt;
| by typing median within brackets student_marks.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:47&lt;br /&gt;
|And the final one To specify the particular columns of a file, we use the parameter usecols is equal to 2,3,4,5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  12:01&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:05&lt;br /&gt;
| Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Parsing-data/English-timed</id>
		<title>Python/C3/Parsing-data/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Parsing-data/English-timed"/>
				<updated>2013-01-02T10:59:39Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and welcome to the tutorial on &amp;quot;Parsing Data&amp;quot;.  |- | 0:06 | At the end of this tutorial, you will be able to,  # Split a …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to the tutorial on &amp;quot;Parsing Data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Split a string using a delimiter.&lt;br /&gt;
# Remove the whitespace around the string.&lt;br /&gt;
# Convert the datatypes of variables from one type to other.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:18&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Lists&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:23&lt;br /&gt;
| Now, invoke the ipython interpreter by typing ipython on your terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:32&lt;br /&gt;
| As you can see, each record consists of fields separated by a colon in the file sslc.txt.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:51&lt;br /&gt;
| The first record is region code, then roll number,name, marks of second language,first language, maths, science and social and total marks.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:06&lt;br /&gt;
|Our job is to calculate the arithmetic mean of all the maths marks in the region &amp;quot;B&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:14&lt;br /&gt;
| Now let us understand, what is meant by 'parsing data'. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:19&lt;br /&gt;
|From the input file, we can see that the data we have is in the form of text. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:25&lt;br /&gt;
|Parsing this data is all about reading it and converting it into a form which can be used for computations -- in our case,it will be a sequence of numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:40&lt;br /&gt;
|We can clearly see that the problem involves reading files and tokenizing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:45&lt;br /&gt;
| Let us learn about tokenizing strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:48&lt;br /&gt;
| We shall define a string first. Type &lt;br /&gt;
 line = &amp;quot;parse this  (a long space)   string&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:05&lt;br /&gt;
| We are now going to split this string on whitespace. type &lt;br /&gt;
line.split()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:17&lt;br /&gt;
| As you can see, we get a list of strings, which means, when &amp;lt;tt&amp;gt;split&amp;lt;/tt&amp;gt; is called without any arguments, it splits on whitespace.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:24&lt;br /&gt;
| In simple words, all the spaces are treated as one big space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:29&lt;br /&gt;
| The function &amp;lt;tt&amp;gt;split&amp;lt;/tt&amp;gt; can also split on a string of our choice.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:34&lt;br /&gt;
| This is achieved by passing that as an argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:36&lt;br /&gt;
| But first lets define a sample record from the file.&lt;br /&gt;
record = &amp;quot;A;015163;JOSEPH RAJ S;083;042;47;0;72;244&amp;quot;&lt;br /&gt;
record.split(';')&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:12&lt;br /&gt;
| We can see that the string is split on the semi-colon and we get each field separately.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:18&lt;br /&gt;
| We can also observe that an empty string appears in the list since there are two semi colons without anything in between.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:25&lt;br /&gt;
|In short, &amp;lt;tt&amp;gt;split&amp;lt;/tt&amp;gt; splits on whitespace if called without an argument and splits on the given argument if it is called with an argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:33&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:39&lt;br /&gt;
| '''Split the variable line using a space as argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:43&lt;br /&gt;
| Is it same as''' splitting without an argument ?&lt;br /&gt;
Type on terminal&lt;br /&gt;
record.split()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:57&lt;br /&gt;
| We see that when we split on space, multiple whitespaces are not clubbed as one and there is an empty string every time there are two consecutive spaces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:09&lt;br /&gt;
| Now that we know how to split a string, we can split the record and retrieve each field separately. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:16&lt;br /&gt;
|But there is one problem.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:17&lt;br /&gt;
| The region code &amp;quot;B&amp;quot; and a &amp;quot;B&amp;quot; surrounded by whitespace are treated as two different regions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:23&lt;br /&gt;
| Hence, we must find a way to remove all the whitespace around a string so that the region code &amp;quot;B&amp;quot; and a &amp;quot;B&amp;quot; with white spaces are dealt as same.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:32&lt;br /&gt;
|This is possible by using the &amp;lt;tt&amp;gt;strip&amp;lt;/tt&amp;gt; method of strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:36&lt;br /&gt;
| Let us define a string by typing&lt;br /&gt;
unstripped = within double quotes a long space B again a long space &lt;br /&gt;
 unstripped.strip()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:01&lt;br /&gt;
| We can see that strip removes all the whitespace around the sentence.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:07&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:13&lt;br /&gt;
| What happens to the white space inside the sentence when it is stripped&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:19&lt;br /&gt;
| We see that, the whitespace inside the sentence is only removed and the rest remains unaffected.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:54&lt;br /&gt;
|type &lt;br /&gt;
 a_str = &amp;quot;  (a long space)       white (again long space)     space (and long space)      &amp;quot;&lt;br /&gt;
 a_str.strip()&lt;br /&gt;
&lt;br /&gt;
 By now we know enough to separate fields from the record and to strip out any white space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:06&lt;br /&gt;
| The only road block we now have, is conversion of string to float.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
|The splitting and stripping operations are done on a string and their result is also a string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:17&lt;br /&gt;
| Hence the marks that we have, are still strings and mathematical operations are not possible on them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:21&lt;br /&gt;
| We must convert them into numbers (integers or floats), before we can perform mathematical operations on them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:31&lt;br /&gt;
| So, We shall now look at converting strings into floats.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:33&lt;br /&gt;
| We define a float string first.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:36&lt;br /&gt;
|So Type&lt;br /&gt;
 mark_str = &amp;quot;1.25&amp;quot;&lt;br /&gt;
 mark = int(float(mark_str))&lt;br /&gt;
 type(mark_str)&lt;br /&gt;
 type(mark)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:22&lt;br /&gt;
| We can see that string is converted to float.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:26&lt;br /&gt;
| We can perform mathematical operations on them now.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:29&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:39&lt;br /&gt;
| What happens if you do int within brackets &amp;quot;1.25&amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:46&lt;br /&gt;
|So type int within brackets 1.25 in the terminal; it raises an error that converting an integer to float directly is not possible&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:00&lt;br /&gt;
|It involves an intermediate type of conversion to float; hence you have to follow the following type of conversion&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:08&lt;br /&gt;
|So type dcml underscore str is equal to within double quotes 1.25; then flt = float within brackets dcml underscore str ; then type flt &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:45&lt;br /&gt;
|Then number is equal to int within brackets flt; then type number.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:00&lt;br /&gt;
| Using &amp;lt;tt&amp;gt;int&amp;lt;/tt&amp;gt;, it is also possible to convert float into integers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:05&lt;br /&gt;
|Now that we have all the machinery required to parse the file, let us solve the problem. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
|We first read the file line by line and parse each record.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:14&lt;br /&gt;
| We then see if the region code is B and store the marks accordingly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:26&lt;br /&gt;
|So type math underscore marks underscore B is equalto empty brackets&lt;br /&gt;
&lt;br /&gt;
for line in open within brackets and double quotes slash home slash fossee slash sslc dot txt colon&lt;br /&gt;
    fields is equal to line dot split within brackets and double quotes ;&lt;br /&gt;
&lt;br /&gt;
    region underscore code is equal to  fields within brackets 0.&lt;br /&gt;
    region underscore code underscore stripped is equal to region underscore code dot strip and empty brackets.&lt;br /&gt;
&lt;br /&gt;
    math underscore mark underscore str is equalto fields within square brackets 5&lt;br /&gt;
    math underscore mark = float within brackets math underscore mark underscore str&lt;br /&gt;
&lt;br /&gt;
    if region underscore code double equalto &amp;quot;B&amp;quot; colon&lt;br /&gt;
        math underscore marks underscore B dot append within brackets math underscore mark&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  12:37&lt;br /&gt;
| Now we have all the math marks of region &amp;quot;B&amp;quot; in the list math_marks_B.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:45&lt;br /&gt;
| To get the mean, we just have to sum the marks and divide by the length.&lt;br /&gt;
type&lt;br /&gt;
 math_marks_mean = sum(math_marks_B) / len(math_marks_B)&lt;br /&gt;
 math_marks_mean&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:24&lt;br /&gt;
| Hence we get our final output. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:27&lt;br /&gt;
|This is how we split and read such a huge data and perform computations on it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:32&lt;br /&gt;
|So, this brings us to the end of the tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:37&lt;br /&gt;
|In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:38&lt;br /&gt;
| 1. Tokenize a string using various delimiters like semi-colons.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:44&lt;br /&gt;
| 2. Split a data separated by delimiters by using the function &amp;lt;tt&amp;gt;split()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:50&lt;br /&gt;
| 3. Get rid of extra white spaces around using the &amp;lt;tt&amp;gt;strip()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:55&lt;br /&gt;
| Convert datatypes of numbers from one type to another.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:59&lt;br /&gt;
| Parse input data and perform computations on it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:05&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:12&lt;br /&gt;
|1. How do you split the string &amp;quot;Guido;Rossum;Python&amp;quot; to get the words.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:26&lt;br /&gt;
|2. How will you remove the extra whitespace in this sentence &amp;quot; Hello World &amp;quot;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:34&lt;br /&gt;
|3. What does int(&amp;quot;20.0&amp;quot;) produce and the options are&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:40&lt;br /&gt;
| 20&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:42&lt;br /&gt;
| 20.0&lt;br /&gt;
&lt;br /&gt;
|- &lt;br /&gt;
|14:43&lt;br /&gt;
| Error&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:44&lt;br /&gt;
|&amp;quot;20&amp;quot;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:47&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:50&lt;br /&gt;
|1. We can split the string the semi-colons by passing it as an argument to the &amp;lt;tt&amp;gt;split&amp;lt;/tt&amp;gt; function as line.split(';')&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:03&lt;br /&gt;
| &amp;quot; Hello World &amp;quot;.strip() will remove the extra whitespaces around the string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:11&lt;br /&gt;
|and the last one int(&amp;quot;20.0&amp;quot;) will give an error, because converting a float string, 20.0, directly into integer is not possible.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:25&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:28&lt;br /&gt;
|Thank you.&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-files/English-timed</id>
		<title>Python/C3/Getting-started-with-files/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-files/English-timed"/>
				<updated>2013-01-02T10:58:14Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello Friends and Welcome to the tutorial on &amp;quot;Getting started with files&amp;quot;.  |- | 0:08 | At the end of this tutorial, you will be able t…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello Friends and Welcome to the tutorial on &amp;quot;Getting started with files&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:08&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Open a file.&lt;br /&gt;
# Read the contents of the file line by line.&lt;br /&gt;
# Read the entire content of file at once.&lt;br /&gt;
# Append the lines of a file to a list.&lt;br /&gt;
# Close the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:24&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Lists&amp;quot; and &amp;quot;Getting started with For&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:34&lt;br /&gt;
|So now, open the terminal and start ipython&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:37&lt;br /&gt;
|So type ipython space hyphen pylab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:46&lt;br /&gt;
| Let us first open the file, &amp;lt;tt&amp;gt;pendulum dot txt&amp;lt;/tt&amp;gt; present in &amp;lt;tt&amp;gt; slash home slash fossee slash&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:54&lt;br /&gt;
|So type f is equal to open within brackets and single quotes slash home slash fossee slash pendulum dot txt. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:11&lt;br /&gt;
| Here &amp;lt;tt&amp;gt;f&amp;lt;/tt&amp;gt; is called a file object.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:14&lt;br /&gt;
| Let us type &amp;lt;tt&amp;gt;f&amp;lt;/tt&amp;gt; on the terminal to see what it is.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:17&lt;br /&gt;
|So type f and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:22&lt;br /&gt;
| The file object shows the filepath and mode of the file which is open.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:27&lt;br /&gt;
| 'r' stand for read only mode and 'w' stands for write mode.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:32&lt;br /&gt;
| As you can see, this file is open in read only mode.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:40&lt;br /&gt;
| We shall first learn to read the whole file into a single variable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:47&lt;br /&gt;
| We use the &amp;lt;tt&amp;gt;read&amp;lt;/tt&amp;gt; method to read all the contents of the file into the variable, &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:53&lt;br /&gt;
|So type pend is equal to f dot read closing brackets and hit Enter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:02&lt;br /&gt;
| Now, let us see what &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt; contains, by typing Print space pend&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:11&lt;br /&gt;
| We can see that &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt; has all the data of the file. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:15&lt;br /&gt;
|Type just &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt; to see more explicitly, what it contains.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:25&lt;br /&gt;
| So now, Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:30&lt;br /&gt;
| Split the variable into a list, pend underscore list, of the lines in the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:40&lt;br /&gt;
| We use the function &amp;lt;tt&amp;gt;splitlines&amp;lt;/tt&amp;gt; to solve this problem.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:44&lt;br /&gt;
|So type pend underscore list is equal to pend dot splitlines closing brackets and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:05&lt;br /&gt;
| Now, let us learn to read the file line-by-line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:11&lt;br /&gt;
| But, before that we will have to close the file, since the file has already been read till the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:19&lt;br /&gt;
|Let us close the file opened into f.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:24&lt;br /&gt;
|Then type f dot close closing brackets and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:29&lt;br /&gt;
| Again type &amp;lt;tt&amp;gt;f&amp;lt;/tt&amp;gt; on the prompt to see what it contains.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:37&lt;br /&gt;
| Notice, that it now says the file has been closed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:42&lt;br /&gt;
| It is a good programming practice to close any file objects that we have opened, after their job is done.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:50&lt;br /&gt;
| Let us, now move on to reading files line-by-line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:54&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:00&lt;br /&gt;
|Re-open the file &amp;lt;tt&amp;gt;pendulum dot txt&amp;lt;/tt&amp;gt; with &amp;lt;tt&amp;gt;f&amp;lt;/tt&amp;gt; as the file object.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:05&lt;br /&gt;
| We just use the up arrow until we reach the open command and issue it again.Then hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:18&lt;br /&gt;
| Now, to read the file line-by-line, we iterate over the file object line-by-line, using the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; command. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:27&lt;br /&gt;
|Let us iterate over the file line-wise and print each of the lines.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:35&lt;br /&gt;
|So type in the command for space line space in space f colon , then , print line.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:47&lt;br /&gt;
| &amp;lt;tt&amp;gt;line&amp;lt;/tt&amp;gt; is a variable, sometimes called the loop variable, and it is not a keyword. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:53&lt;br /&gt;
|We could have used any other variable name, but &amp;lt;tt&amp;gt;line&amp;lt;/tt&amp;gt; seems meaningful enough.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:00&lt;br /&gt;
| Instead of just printing the lines, let us append them to a list, &amp;lt;tt&amp;gt;line underscore list&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:07&lt;br /&gt;
|We first initialize an empty list, &amp;lt;tt&amp;gt;line underscore list&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:12&lt;br /&gt;
|for that type line underscore list is equal to square bracket and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:22&lt;br /&gt;
| Let us then read the file line-by-line and then append each of the lines to the list. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:30&lt;br /&gt;
|We could, as usual close the file using &amp;lt;tt&amp;gt;f.close&amp;lt;/tt&amp;gt; and re-open it. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:36&lt;br /&gt;
|But, this time, let's leave alone the file object &amp;lt;tt&amp;gt;f&amp;lt;/tt&amp;gt; and directly open the file within the for statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:43&lt;br /&gt;
| This will save us the trouble of closing the file, each time we open it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:49&lt;br /&gt;
|So type for line in open within brackets and single quotes slash home slash fossee slash pendulum dot txt colon&lt;br /&gt;
&lt;br /&gt;
    line underscore list dot append within brackets line,Hit Enter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:22&lt;br /&gt;
| Let us see what &amp;lt;tt&amp;gt;line underscore list&amp;lt;/tt&amp;gt; contains.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:26&lt;br /&gt;
|so type line underscore list and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:33&lt;br /&gt;
| Notice that &amp;lt;tt&amp;gt;line_list&amp;lt;/tt&amp;gt; is a list of the lines in the file, along with the newline characters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:42&lt;br /&gt;
| If you noticed, &amp;lt;tt&amp;gt;pend underscore list&amp;lt;/tt&amp;gt; did not contain the newline characters, because the string &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt;, was split on the newline characters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:52&lt;br /&gt;
|We can strip out the newline characters from the lines by using some string methods which we shall look in the further tutorial on strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:04&lt;br /&gt;
| So now, This brings us to the end of this tutorial. Lets revise what we have learnt,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:12&lt;br /&gt;
|1. Open and close files using the &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;close&amp;lt;/tt&amp;gt; functions respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:17&lt;br /&gt;
|2. Read the data in the files as a whole,by using the &amp;lt;tt&amp;gt;read&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:22&lt;br /&gt;
|3. Read the data in the files line by line by iterating over the file object using the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:31&lt;br /&gt;
|and finally Append the lines of a file to a list using the &amp;lt;tt&amp;gt;append&amp;lt;/tt&amp;gt; function within the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:38&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:42&lt;br /&gt;
|1. The &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt; function returns a&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:46&lt;br /&gt;
| string&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:48&lt;br /&gt;
| list&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:49&lt;br /&gt;
| file object&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:50&lt;br /&gt;
| function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:52&lt;br /&gt;
|2. What does the function &amp;lt;tt&amp;gt;splitlines()&amp;lt;/tt&amp;gt; do.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:57&lt;br /&gt;
| Displays the data as strings,all in a line&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:01&lt;br /&gt;
| Displays the data line by line as strings&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:03&lt;br /&gt;
| Displays the data line by line but not as strings&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:07&lt;br /&gt;
| So now,let us look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:09&lt;br /&gt;
|1.The function &amp;lt;tt&amp;gt;open&amp;lt;/tt&amp;gt;, returns a file object.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:15&lt;br /&gt;
|2. The function &amp;lt;tt&amp;gt;splitlines&amp;lt;/tt&amp;gt; displays the data line by line as strings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:21&lt;br /&gt;
| So we hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:27&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-strings/English-timed</id>
		<title>Python/C3/Getting-started-with-strings/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-strings/English-timed"/>
				<updated>2013-01-02T10:57:26Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:01 | Hello friends and Welcome to the tutorial on &amp;quot;Getting started with strings&amp;quot;.  |- | 0:06 | At the end of this tutorial, you will be able…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello friends and Welcome to the tutorial on &amp;quot;Getting started with strings&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Define strings in different ways.&lt;br /&gt;
# Concatenate strings.&lt;br /&gt;
# Print a string repeatedly.&lt;br /&gt;
# Access individual elements of the string.&lt;br /&gt;
# Learn immutability of strings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:25&lt;br /&gt;
| Open the terminal and invoke the ipython interpreter by typing ipython, so type ipython and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:35&lt;br /&gt;
| So, what are strings?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:38&lt;br /&gt;
| In Python anything within either single quotes or double quotes or triple single quotes or triple double quotes are strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:51&lt;br /&gt;
|So you can type within single quotes This is a string, then in double quotes This is a string too.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:06&lt;br /&gt;
|Then in triple double quotes This is also a string&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:26&lt;br /&gt;
| Note that it really doesn't matter how many characters are present in the string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:32&lt;br /&gt;
|So we can even put a null string or an empty string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:40&lt;br /&gt;
|Having more than one control character to define strings is handy when one of the control characters itself is part of the string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:50&lt;br /&gt;
|For example you can type in double quotes Python's string manipulation functions are very useful&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:16&lt;br /&gt;
| By having multiple control characters, we avoid the need for escaping characters hyphen hyphen in this case the apostrophe.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:28&lt;br /&gt;
|Let us now move on to the triple quoted strings. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:32&lt;br /&gt;
|Let us define multi-line strings without using any escaping.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:36&lt;br /&gt;
| Everything within the triple quotes is a single string no matter how many lines it extends&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:44&lt;br /&gt;
|So we can type in the terminal, within triple double quotes Having more than one control character to define strings come as very handy when one of the control characters itself is part of the string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:59&lt;br /&gt;
|So, we can assign this string to any variable&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:04&lt;br /&gt;
|So lets type a = within single quotes Hello comma  World exclamation and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:17&lt;br /&gt;
| Now 'a' is a string variable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:21&lt;br /&gt;
| String is a collection of characters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:23&lt;br /&gt;
| In addition string is an immutable collection which means that the string cannot be modified after it is created.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:30&lt;br /&gt;
| So all the operations that are applicable to any other immutable collection in Python, works on strings as well.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:38&lt;br /&gt;
| Hence we can add two strings&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:41&lt;br /&gt;
|So lets type a = within single quotes Hello and hit enter, b = within single quotes World&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:58&lt;br /&gt;
|c = a plus in single quotes comma plus b plus in single quotes exclamation and hit enter then&lt;br /&gt;
print c&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:25&lt;br /&gt;
|So you will get an output hello comma world&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:33&lt;br /&gt;
| We can add string variables as well as the strings themselves all in the same statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:38&lt;br /&gt;
| The same addition operation performs the concatenation of two strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:44&lt;br /&gt;
| Similarly we can multiply a string with an integer&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:48&lt;br /&gt;
|So lets type a =  in single quotes Hello&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:58&lt;br /&gt;
|Type a into  5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:03&lt;br /&gt;
|So we will get output as hello into 5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:09&lt;br /&gt;
| It gives another string in which the original string 'Hello' is repeated 5 times.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:16&lt;br /&gt;
| Now, pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:22&lt;br /&gt;
|Obtain the string &amp;lt;tt&amp;gt;percentage percentage 20 hyphens percentage percentage&amp;lt;/tt&amp;gt;  without typing out all the twenty hyphens.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:32&lt;br /&gt;
| Let's now look at accessing individual elements of strings. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:37&lt;br /&gt;
|Since, strings are collections, we can access individual items in the string using the subscripts&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:44&lt;br /&gt;
|So type s = within double quotes percentage percentage  plus within double quotes hyphen multiply by 20 plus within double quotes percentage percentage and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:11&lt;br /&gt;
|Now to get an output print s&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:20 &lt;br /&gt;
| &amp;lt;nowiki&amp;gt;a in square bracket zero gives us the first character in the string. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:26&lt;br /&gt;
|The indexing starts from 0 for the first character and goes up to (n minus 1) for the last character, where 'n' is the total number of characters in a string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:39&lt;br /&gt;
| We can access the strings from the end using negative indices&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:44&lt;br /&gt;
|So type a in square bracket zero and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:50&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;a in square bracket minus 1 gives us the last element of the string and a[-2] gives us second element from the end of the string.&amp;lt;/nowiki&amp;gt;So type a in square bracket minus 1 and hit enter, then a in square bracket minus 2 and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:10&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:14&lt;br /&gt;
|Given a string, &amp;lt;tt&amp;gt;s = within double quotes Hello World&amp;lt;/tt&amp;gt;, what is the output of&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:22&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;s[ minus 5]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:25&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;s[ minus 10]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:27&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;s[minus 15]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:34&lt;br /&gt;
| Now, &amp;lt;nowiki&amp;gt;s of [-5] gives us 'W'&amp;lt;/nowiki&amp;gt;.So in terminal type s of [-5] and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:45&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;s of [-10] gives us 'e' and&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:51&lt;br /&gt;
|So we got an error of hyphen,so lets update the value of s with hello world. So type s = Hello World&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:09&lt;br /&gt;
|Now s of -5 is W. So we got the output as W&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:18&lt;br /&gt;
|So next type s of -10, it gives us e &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:26&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;And s of [-15] gives us an &amp;lt;/nowiki&amp;gt;&amp;lt;tt&amp;gt;IndexError&amp;lt;/tt&amp;gt;, as should be expected, since the string given to us is only 11 characters long.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:37&lt;br /&gt;
| Let us attempt to change one of the characters in a string&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:42&lt;br /&gt;
|So type a = 'hello' and a of [0] = 'H'&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:58&lt;br /&gt;
| As said earlier, strings are immutable.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:01&lt;br /&gt;
| We cannot manipulate a string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:03&lt;br /&gt;
| Although there are some methods which let us manipulate strings, we will look at them in the advanced session on strings.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
| In addition to the methods that let us manipulate the strings we have methods like split which lets us break the string on the specified separator, the join method which lets us combine the list of strings into a single string based on the specified separator.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:30&lt;br /&gt;
| Let's revise quickly what we have learnt today. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:33&lt;br /&gt;
|In this tutorial we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:36&lt;br /&gt;
| 1. Define strings in different ways.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:39&lt;br /&gt;
| 2. Concatenate strings by performing addition.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:42&lt;br /&gt;
| 3.Repeat a string 'n' number of times by doing multiplication.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:47&lt;br /&gt;
| 4. Access individual elements of the string by using their subscripts.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:53&lt;br /&gt;
| 5. And finally use of the concept of immutability of strings.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:58&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:02&lt;br /&gt;
| 1.Write code to assign s, the string &amp;lt;tt&amp;gt;' is called the apostrophe&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:11&lt;br /&gt;
| 2. Given strings s and t, &amp;lt;tt&amp;gt;s = &amp;quot;Hello&amp;quot;&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;t = &amp;quot;World&amp;quot;&amp;lt;/tt&amp;gt; and an integer r, &amp;lt;tt&amp;gt;r = 2&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:21&lt;br /&gt;
|What is the output of s multiply r plus  s multiply t?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:27&lt;br /&gt;
| 3.How will you change s='hello' to s='Hello'.with h in capital&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:37&lt;br /&gt;
| So, &amp;lt;nowiki&amp;gt;s of [0]= H&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:40&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;s of [0]=in single quotes h&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:44&lt;br /&gt;
| Third option is strings are immutable,hence cannot be manipulated&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:49&lt;br /&gt;
| Let's look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:52&lt;br /&gt;
|1. The given string can be assigned in this manner&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:55&lt;br /&gt;
| So type s = in double quotes` is called the apostrophe&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:06&lt;br /&gt;
|2. The operation &amp;lt;tt&amp;gt; s into r plus  s into t&amp;lt;/tt&amp;gt; will print each of the two words twice&amp;lt;br/&amp;gt; HelloHelloWorldWorld&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:20&lt;br /&gt;
| Strings are immutable. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:22&lt;br /&gt;
|Therefore they cannot be manipulated.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:26&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:29&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-for/English-timed</id>
		<title>Python/C3/Getting-started-with-for/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-for/English-timed"/>
				<updated>2013-01-02T10:56:35Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello and welcome to the tutorial on ''Getting started with ``for`'' loop`.  |- | 0:07 | At the end of this tutorial, you will be able …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello and welcome to the tutorial on ''Getting started with ``for`'' loop`.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:07&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Write blocks of code in python using indentation.&lt;br /&gt;
# Use the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
# Use &amp;lt;tt&amp;gt;range()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
# Write blocks in python interpreter&lt;br /&gt;
# Write blocks in ipython interpreter.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:25&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Getting started with Lists&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:31&lt;br /&gt;
|In Python whitespace is significant, and the blocks are visually separated. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:38&lt;br /&gt;
|The best practice is to indent the code using four spaces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:41&lt;br /&gt;
|As you can see in the slide, &amp;quot;Block B&amp;quot; is an inner block, indented by 4 spaces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:48&lt;br /&gt;
| After &amp;quot;Block B&amp;quot; the next statement in &amp;quot;Block A&amp;quot; starts from the same indentation level of other &amp;quot;Block A&amp;quot; Statements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:58&lt;br /&gt;
| Start the ipython interpreter using ipython hyphen pylab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:08&lt;br /&gt;
| Now let us move straight into &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:11&lt;br /&gt;
| Write a for loop which iterates through a list of numbers and find the square root of each number. numbers are 1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:37&lt;br /&gt;
| For the problem, first we need to create a &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; of numbers and then iterate over the list and find the square root of each element in it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:45&lt;br /&gt;
| And let us create a script, rather than typing it out in the interpreter itself.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:50&lt;br /&gt;
| Open your text editor and type the following code shown on the slide.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:56&lt;br /&gt;
| Now switch to your terminal and run the script .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:05&lt;br /&gt;
|In the terminal run the script as  percentage run space hyphen i space list underscore roots dot py. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:24&lt;br /&gt;
| So that was easy!&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:27&lt;br /&gt;
| All what we did was iterate over the list element by element and then use the element for calculation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:36&lt;br /&gt;
| Note that here we used two variables,the variable &amp;lt;tt&amp;gt;numbers&amp;lt;/tt&amp;gt;, which is a list,and the other variable &amp;lt;tt&amp;gt;each&amp;lt;/tt&amp;gt;, which is the element of list under consideration in each cycle of the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:50&lt;br /&gt;
| The variable names can be chosen by you.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:52&lt;br /&gt;
| Note that the lines after &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; statement, is indented using four spaces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:01&lt;br /&gt;
| It means that line is a part of the for loop. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:05&lt;br /&gt;
|And it is a block of code, although it is only a single statement in the block.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:10&lt;br /&gt;
| Also, the fourth line or the immediate line after the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; block is not indented.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:18&lt;br /&gt;
| It means that it is not a part of the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop and the lines after that dont fall in the scope of the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:29&lt;br /&gt;
|Thus each block is separated by the indentation level and that marks the importance of white-spaces in Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:35&lt;br /&gt;
| Print the square root of numbers in the list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:38&lt;br /&gt;
| And this time let us do it right in the IPython interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:47&lt;br /&gt;
| So let us create a list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:53&lt;br /&gt;
| You will notice that, as soon as you press the enter key after for statement, the prompt changes to four dots and the cursor is not right after the four dots but there are four spaces from the dots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:07&lt;br /&gt;
|numbers is equal to within square brackets 1369, 7225, 3364, 7056, 5625, 729, 7056, 576, 2916&lt;br /&gt;
Then type for each in numbers colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:37&lt;br /&gt;
|So you can see the four dots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:43&lt;br /&gt;
| Please note that IPython automatically indents the block.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:48&lt;br /&gt;
| The four dots tell you that you are inside a block.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:53&lt;br /&gt;
| Now type the rest of the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:56&lt;br /&gt;
|So type print  within double quotes Square root of, each, then print within double quotes is comma sqrt in brackets each.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:29&lt;br /&gt;
| Now we have finished the statements in the block, and still the interpreter is showing four dots, this means that you are still inside the block.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:41&lt;br /&gt;
| To exit from the block press the return key or the enter key twice without entering anything else.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:50&lt;br /&gt;
| It printed the square root of each number in the list, which was executed in the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:57&lt;br /&gt;
| Find the cube of all the numbers from one to ten.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:01&lt;br /&gt;
| But this time let us try it in the vanilla version of Python interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:07&lt;br /&gt;
| Start the vanilla version of Python interpreter by issuing the command &amp;lt;tt&amp;gt;python&amp;lt;/tt&amp;gt; in your terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:21&lt;br /&gt;
|So type for i in range within brackets 1,11 colon&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:38&lt;br /&gt;
| press enter once, and we will see that this time it shows four dots, but the cursor is close to the dots, so we have to indent the block.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:52&lt;br /&gt;
| The vanilla version of Python interpreter does not indent the code automatically.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:58&lt;br /&gt;
| So enter four spaces there and then type the following&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:04&lt;br /&gt;
|Then type print i comma within double quotes cube is comma i star star 3. Hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:21&lt;br /&gt;
| Now when we hit Enter, we still see the four dots. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:26&lt;br /&gt;
|To get out of the block, hit enter once again.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:32&lt;br /&gt;
| Okay! &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:33&lt;br /&gt;
|so the main thing we learnt here is how to use the Python interpreter and the IPython interpreter to specify blocks. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:43&lt;br /&gt;
|But while we were generating the multiplication table we used something new, &amp;lt;tt&amp;gt;range&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:50&lt;br /&gt;
| &amp;lt;tt&amp;gt;range&amp;lt;/tt&amp;gt; function is an inbuilt function in Python which can be used to generate a &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt; of integers from a starting number to an ending number. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:57&lt;br /&gt;
|Note that the ending number that you specify will not be included in the &amp;lt;tt&amp;gt;list&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:03&lt;br /&gt;
| Print all the odd numbers from 1 to 50. Let us do it in our IPython interpreter for ease of use.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:18&lt;br /&gt;
| The problem can be solved by just using the &amp;lt;tt&amp;gt;range()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:22&lt;br /&gt;
|It can be solved as through command line you can type ipython and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:28&lt;br /&gt;
| This time we passed three parameters to &amp;lt;tt&amp;gt;range()&amp;lt;/tt&amp;gt; function unlike the previous case where we passed only two parameters. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:37&lt;br /&gt;
|The first two parameters are same in both the cases. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:40&lt;br /&gt;
|The first parameter is the starting number of the sequence and the second parameter is the end of the range.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:45&lt;br /&gt;
| Note that the sequence does not include the ending number.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:48&lt;br /&gt;
| The third parameter is for stepping through the sequence.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:53&lt;br /&gt;
| Here we gave two which means we are skipping every alternate element.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:03&lt;br /&gt;
|So type print range within brackets 1 comma 51 comma 2 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:07&lt;br /&gt;
| This brings us to the end of the tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:11&lt;br /&gt;
|In this tutorial,we learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:12&lt;br /&gt;
| 1. create blocks in python using &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:15&lt;br /&gt;
| 2. indent the blocks of code&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:17&lt;br /&gt;
| 3. iterate over a list using &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:21&lt;br /&gt;
| use the &amp;lt;tt&amp;gt;range()&amp;lt;/tt&amp;gt; function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:24&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:27&lt;br /&gt;
| 1. Indentation is not mandatory in Python&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:30&lt;br /&gt;
| Is it true or false?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:33&lt;br /&gt;
| 2. Write a code using &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop to print the product of all natural numbers from 1 to 20.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:39&lt;br /&gt;
| 3. What will be the output of-&lt;br /&gt;
&lt;br /&gt;
 range within brackets 1,5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:47&lt;br /&gt;
| Now, the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:48&lt;br /&gt;
| 1. False. Indentation is essential in python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:53&lt;br /&gt;
| 2. We use the &amp;lt;tt&amp;gt;for&amp;lt;/tt&amp;gt; loop in the following manner.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:56&lt;br /&gt;
| y is equal to 1 for x in range(1,21):&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:00&lt;br /&gt;
| y star is equal to x&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:03&lt;br /&gt;
| then we have to print y&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:04&lt;br /&gt;
| 3. &amp;lt;tt&amp;gt;range within brackets 1,5&amp;lt;/tt&amp;gt;&amp;lt;nowiki&amp;gt; will produce a list of integers from 1 to 4.&amp;lt;/nowiki&amp;gt; that is 1,2,3,4 in square brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:17&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:20&lt;br /&gt;
|Thank you!&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-lists/English-timed</id>
		<title>Python/C3/Getting-started-with-lists/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C3/Getting-started-with-lists/English-timed"/>
				<updated>2013-01-02T10:55:26Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and welcome to the tutorial on &amp;quot;Getting started with lists&amp;quot;.  |- |  0:06 | In this tutorial we will be getting acquainted…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to the tutorial on &amp;quot;Getting started with lists&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:06&lt;br /&gt;
| In this tutorial we will be getting acquainted with a python data structure called lists. At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Create lists&lt;br /&gt;
# Access list elements&lt;br /&gt;
# Append elements to lists&lt;br /&gt;
# Delete elements from lists&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:23&lt;br /&gt;
| So now, List is a compound data type, it can contain data of mutually different data types.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:32&lt;br /&gt;
| List is also a sequence data type where all the elements are arranged in a specific order.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:36&lt;br /&gt;
|Start the ipython interpreter and first create an empty list with no elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:41&lt;br /&gt;
|In command ipython.Then type empty is equal to square brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:53&lt;br /&gt;
|Then type within brackets empty.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:59&lt;br /&gt;
| This is an empty list without any elements.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:03&lt;br /&gt;
|Lets define a non-empty list as nonempty is equal to  within square brackets and in single quotes spam comma within single quotes eggs comma 100 comma  1.234] &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:24&lt;br /&gt;
| Thus, the simplest way of creating a list is typing out a sequence of comma-separated values (or items) between two square brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:34&lt;br /&gt;
| As we can see, lists can contain different kinds of data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:37&lt;br /&gt;
| In the previous example 'spam' and 'eggs' are strings whereas 100 and 1.234 are integer and float respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:48&lt;br /&gt;
| Thus, we can put elements of different data types in lists including lists itself.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:54&lt;br /&gt;
| This property makes lists heterogeneous data structures.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:59&lt;br /&gt;
| Let us include a list within a list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:02 &lt;br /&gt;
| &amp;lt;nowiki&amp;gt;We access an element of a list using its corresponding index. &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:07&lt;br /&gt;
|So type in command listinlist is equal to square brackets [4,2,3,4],'and', 1, 2, 3, 4.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:41&lt;br /&gt;
|So now we can access an element of a list using its corresponding index.&lt;br /&gt;
 &lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|Index of the first element of a list is 0. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:53&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;So for the list nonempty, nonempty[0] gives the first element, nonempty[1] the second element and so on and nonempty[3] the last element.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:23&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:28&lt;br /&gt;
|&amp;lt;nowiki&amp;gt;What happens when you do nonempty[-1].&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:34&lt;br /&gt;
|YOu can switch to terminal and type nonempty -1 in square brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:44&lt;br /&gt;
| As you can see you get the data of last element which is 1.234.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:53&lt;br /&gt;
| In python negative indices are used to access elements from the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:58&lt;br /&gt;
| So, -1 gives the last element which is the 4th element , -2 gives second element to last and -4 gives the fourth from the last which, in this case, is the first element.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:15&lt;br /&gt;
|So type nonempty -1 nonempty[-2] then nonempty -4.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:24&lt;br /&gt;
| We can also append elements to the end of a list using the &amp;lt;tt&amp;gt;append&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:28&lt;br /&gt;
|So type nonempty dot append within brackets and single quotes onemore.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:41&lt;br /&gt;
|We can see an error &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:46&lt;br /&gt;
|Then type nonempty ; then type nonempty dot append within brackets 6.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:09&lt;br /&gt;
|then again nonempty.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:15&lt;br /&gt;
| Please, pause the video here, do the exercise and then continue.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:21&lt;br /&gt;
| 1. What is the syntax to get the element 'and' in the list,listinlist ?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:29&lt;br /&gt;
|2. How would you get 'and' using negative indices?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:34&lt;br /&gt;
| So, the solution is on your screen&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:38&lt;br /&gt;
|As we can see nonempty is appended with 'onemore' and 6 at the end.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:45&lt;br /&gt;
| Let us move further. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:47&lt;br /&gt;
|We can use &amp;lt;tt&amp;gt;len&amp;lt;/tt&amp;gt; function to check the number of elements in the list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:50&lt;br /&gt;
| Let us find out the length of the list 'nonempty'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:54&lt;br /&gt;
|So type in command len within brackets nonempty .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:05&lt;br /&gt;
| Just like we can append elements to a list, we can also remove them. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:08&lt;br /&gt;
|There are two ways of doing it. One is by using index.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:12&lt;br /&gt;
|So type del within brackets nonempty and square brackets 1. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:26&lt;br /&gt;
| The function &amp;lt;tt&amp;gt;del&amp;lt;/tt&amp;gt; deletes the element at index 1, i.e the second element of the list, 'eggs'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:34&lt;br /&gt;
|The other way is removing element by content.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:37&lt;br /&gt;
| Lets say one wishes to delete 100 from nonempty list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:41&lt;br /&gt;
|For this, one could use the function &amp;lt;tt&amp;gt;remove&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:55&lt;br /&gt;
| But what if there were two 100's.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:57&lt;br /&gt;
| To check that lets do a small experiment.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:01&lt;br /&gt;
|Now, in command nonempty dot append within brackets and single quotes spam.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:11&lt;br /&gt;
| Then type nonempty.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:15&lt;br /&gt;
|Then type nonempty dot remove within brackets and single quotes spam; then type nonempty for the output.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:29&lt;br /&gt;
| If we now check, we will see that the first occurence 'spam' is removed and therefore the function ''remove'' removes the first occurence of the element in the sequence and leaves others untouched.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:39&lt;br /&gt;
|One should remember this, that while &amp;lt;tt&amp;gt;del&amp;lt;/tt&amp;gt; removes by index number, ''remove'' removes on the basis of content being passed on.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:50&lt;br /&gt;
| Let us take an example.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  7:53&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;del gives us [1,2,3].&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:59&lt;br /&gt;
|So type on the terminal k is equal to 1,2 ,1,3 and then type del within brackets and square brackets k and square brackets 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:25&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;remove will give us [2,1,3]. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:29&lt;br /&gt;
|Since it deletes the first occurrence of what is returned by x[2] which is 1.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:37&lt;br /&gt;
|So type k dot remove and in brackets x and square brackets 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:59&lt;br /&gt;
|As we have seen an error we have to change x of 2 to k of 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:09&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:14&lt;br /&gt;
|1. Remove the third element from the list, listinlist.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:19&lt;br /&gt;
|2. Remove 'and' from the list, listinlist.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:24&lt;br /&gt;
| The solution is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:29&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:30&lt;br /&gt;
| In this tutorial, we have learnt to, Create lists, Access lists using their index numbers, Append elements to list using the function &amp;lt;tt&amp;gt;append&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:40&lt;br /&gt;
| Delete Element from lists by specifying the index number of the element to be deleted in the &amp;lt;tt&amp;gt;del&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:47&lt;br /&gt;
|Then,Delete element from list by content using &amp;lt;tt&amp;gt;remove&amp;lt;/tt&amp;gt; function and final one is Find out the list length using &amp;lt;tt&amp;gt;len&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:59&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:02&lt;br /&gt;
|1. How do you create an empty list?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:05&lt;br /&gt;
|2. Can you have a list inside a list ?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:09&lt;br /&gt;
|3. How would you access the end of a list without finding its length?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:15&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:18&lt;br /&gt;
|1. We create an empty list just by leaving the space inside the square brackets empty.&amp;lt;br/&amp;gt;  &amp;lt;nowiki&amp;gt;empty=[]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:30&lt;br /&gt;
|2. Yes.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:34&lt;br /&gt;
|List can contain all the other data types, including list.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:44&lt;br /&gt;
| Here is an example&amp;lt;br/&amp;gt;  &amp;lt;nowiki&amp;gt;list_in_list=[2.3,[2,4,6],'string,'all datatypes can be there']&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:56&lt;br /&gt;
|3. Using negative indices, we can access the list from the end using negative indices.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:04&lt;br /&gt;
| This is an example&amp;lt;br/&amp;gt;  &amp;lt;nowiki&amp;gt;nonempty = ['spam', 'eggs', 100, 1.234]&amp;lt;/nowiki&amp;gt; &amp;lt;nowiki&amp;gt;nonempty[-1]&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:15&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:19&lt;br /&gt;
|Thank you!&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Other-types-of-plots/English-timed</id>
		<title>Python/C2/Other-types-of-plots/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Other-types-of-plots/English-timed"/>
				<updated>2013-01-02T10:53:40Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello Friends and welcome to the tutorial on &amp;lt;tt&amp;gt;Other types of plots&amp;lt;/tt&amp;gt;.  |- | 0:06 | Till now we have seen only one kind of plo…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello Friends and welcome to the tutorial on &amp;lt;tt&amp;gt;Other types of plots&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| Till now we have seen only one kind of plotting.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:10&lt;br /&gt;
| Hence in this tutorial we will be looking at some more kinds of plots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:16&lt;br /&gt;
|At the end of this tutorial, you will be able to&lt;br /&gt;
&lt;br /&gt;
# Create scatter plot&lt;br /&gt;
# Create pie charts&lt;br /&gt;
# Create bar charts&lt;br /&gt;
# Create log-log plots&lt;br /&gt;
# Use the matplotlib help&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:29&lt;br /&gt;
| So let us begin with scatter plot&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:33&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Loading data from files&amp;quot; and &amp;quot;Plotting data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:42&lt;br /&gt;
| In a scatter plot, the data is displayed as a collection of points, where each point determines it's position on the horizontal axis and the vertical axis respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:54&lt;br /&gt;
| This kind of plot is also called a scatter chart, a scatter diagram or a scatter graph.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:01&lt;br /&gt;
| Before we start with the topic, let us start our IPython interpreter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:06&lt;br /&gt;
|So type ipython hypen pylab&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:13&lt;br /&gt;
| Plot a scatter plot showing the percentage profit of a company A from the year 2000-2010.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:22&lt;br /&gt;
| The data for the same is available in the file &amp;lt;tt&amp;gt;company-a-data.txt&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
|Type cat space slash home slash fossee bacslash other-plot slash company-a-data.txt (enter)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:50&lt;br /&gt;
| The data file has two lines with a set of values in each line, the first line representing years and the second line representing the profit percentages.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:02&lt;br /&gt;
| To produce the scatter plot, we first need to load the data from the file using &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:10&lt;br /&gt;
|Type year,profit = loadtxt within bracket in single quote slash home slash fossee slash other-plot slash company-a-data.txt comma dtype=type in bracket int() hit enter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:52&lt;br /&gt;
| By default loadtxt converts the value to float.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:57&lt;br /&gt;
| The &amp;lt;tt&amp;gt;dtype=type within bracket int()&amp;lt;/tt&amp;gt; argument in loadtxt converts the value to integer, as we require the data as integer further in the tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:11&lt;br /&gt;
| Now in-order to generate the scatter graph we will use the function &amp;lt;tt&amp;gt;scatter()&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:18&lt;br /&gt;
|Type scatter within bracket year comma profit and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:32&lt;br /&gt;
| Notice that we passed two arguments to &amp;lt;tt&amp;gt;scatter()&amp;lt;/tt&amp;gt; function, first one the values in x-coordinate, year, and the other the values in y-coordinate, the profit percentage.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:57&lt;br /&gt;
| Plot a scatter plot of the same data in company-a-data.txt with red diamond markers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:09&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:17&lt;br /&gt;
|Now let us see another kind of plot, the pie chart, for the same data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:40&lt;br /&gt;
| A pie chart or a circle graph is a circular chart divided into sectors, illustrating proportion.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:49&lt;br /&gt;
| Plot a pie chart representing the profit percentage of company A, with the same data from file &amp;lt;tt&amp;gt;company-a-data.txt&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:00&lt;br /&gt;
|So let us reuse the data we have loaded from the file previously.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:11&lt;br /&gt;
| We can plot the pie chart using the function &amp;lt;tt&amp;gt;pie()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:15&lt;br /&gt;
|Type pie within bracket profit comma labels=year&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:29&lt;br /&gt;
| Notice that we passed two arguments to the function &amp;lt;tt&amp;gt;pie()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:33&lt;br /&gt;
| First one the values and the next one the set of labels to be used in the pie chart.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:38&lt;br /&gt;
| Plot a pie chart with the same data with colors for each wedges as white, red, black, magenta,yellow, blue, green, cyan, yellow, magenta and blue respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:58&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  6:05&lt;br /&gt;
| Now let us move on to the bar charts.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:08&lt;br /&gt;
| A bar chart or bar graph is a chart with rectangular bars with lengths proportional to the values that they represent.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:19&lt;br /&gt;
| Plot a bar chart representing the profit percentage of company A, with the same data from file &amp;lt;tt&amp;gt;company-a-data.txt&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:30&lt;br /&gt;
|So let us reuse the data we have loaded from the file previously.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:34&lt;br /&gt;
| We can plot the bar chart using the function &amp;lt;tt&amp;gt;bar()&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:44&lt;br /&gt;
|type bar within bracket year comma profit&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:52&lt;br /&gt;
| Note that the function &amp;lt;tt&amp;gt;bar()&amp;lt;/tt&amp;gt; needs at least two arguments one the values in x-coordinate and the other values in y-coordinate which is used to determine the height of the bars.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:05&lt;br /&gt;
| Plot a bar chart which is not filled and which is hatched with 45&amp;lt;sup&amp;gt;o&amp;lt;/sup&amp;gt; slanting lines as shown in the image.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:17&lt;br /&gt;
|The data for the chart may be obtained from the file &amp;lt;tt&amp;gt;company-a-data.txt&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:26&lt;br /&gt;
|Type bar within bracket year comma profit comma fill=False comma hatch=slash in single quote hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:05&lt;br /&gt;
| Now let us move on to the log-log plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:10&lt;br /&gt;
| A log-log graph or a log-log plot is a two-dimensional graph of numerical data that uses logarithmic scales on both the horizontal and vertical axes.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:24&lt;br /&gt;
| Because of the nonlinear scaling of the axes, a function of the form y = ax&amp;lt;sup&amp;gt;b&amp;lt;/sup&amp;gt; will appear as a straight line on a log-log graph&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  8:38&lt;br /&gt;
| Plot a ''log-log'' chart of y=5 into x&amp;lt;sup&amp;gt;3&amp;lt;/sup&amp;gt; for x from 1-20.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:49&lt;br /&gt;
| Before we actually plot let us calculate the points needed for that.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:54&lt;br /&gt;
|x = linspace within brackets 1 comma 20 comma 100&lt;br /&gt;
 y = 5 into x into into 3&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:23&lt;br /&gt;
| Here is the syntax of the log-log function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:28&lt;br /&gt;
| Now we can plot the log-log chart using &amp;lt;tt&amp;gt;loglog()&amp;lt;/tt&amp;gt; function,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:34&lt;br /&gt;
|Type loglog within brackets x comma y hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:48&lt;br /&gt;
| To understand the difference between a normal &amp;lt;tt&amp;gt;plot&amp;lt;/tt&amp;gt; and a &amp;lt;tt&amp;gt;log-log plot&amp;lt;/tt&amp;gt; let us create another plot using the function &amp;lt;tt&amp;gt;plot&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:57&lt;br /&gt;
|figure within brackets 2&lt;br /&gt;
plot within brackets x comma y&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:24&lt;br /&gt;
| The difference is clear.So that was &amp;lt;tt&amp;gt;log-log() plot&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:33&lt;br /&gt;
| Now we will see few more plots and also see how to access help of matplotlib over the Internet.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:43&lt;br /&gt;
|Help about matplotlib can be obtained from matplotlib.sourceforge.net/contents.html&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:55&lt;br /&gt;
|More plots can be seen at matplotlib.sourceforge.net slash users slash screenshots.html and also at matplotlib.sourceforge.net slash gallery.html&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:13&lt;br /&gt;
| This brings us to the end of this tutorial. In this tutorial we learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:20&lt;br /&gt;
| 1. Plot a scatter plot using &amp;lt;tt&amp;gt;scatter()&amp;lt;/tt&amp;gt; function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:22&lt;br /&gt;
| 2. Plot a pie chart using &amp;lt;tt&amp;gt;pie()&amp;lt;/tt&amp;gt; function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:25&lt;br /&gt;
| 3. Plot a bar chart using &amp;lt;tt&amp;gt;bar()&amp;lt;/tt&amp;gt; function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:28&lt;br /&gt;
| 4. Plot a log-log graph using &amp;lt;tt&amp;gt;loglog()&amp;lt;/tt&amp;gt; function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:33&lt;br /&gt;
| 5. Access the matplotlib online help.Thank you.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:42&lt;br /&gt;
| Here are some self assessment questions for you to solve.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:46&lt;br /&gt;
|1. &amp;lt;tt&amp;gt;scatter within bracket x comma y comma  color=blue in single quotes comma marker= in single quotesd&amp;lt; slash tt&amp;gt; and &amp;lt;tt&amp;gt;plot within bracket x comma y comma color=b in single quotes comma marker=in single quotes d)&amp;lt;/tt&amp;gt; does exactly the same.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:04&lt;br /&gt;
| Is True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:07&lt;br /&gt;
| . What statement can be issued to generate a bar chart with vertical line hatching.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:15&lt;br /&gt;
| bar  within bracket x comma y comma color=w in single quote comma hatch=in single quote slash&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:27&lt;br /&gt;
| bar within bracket x comma y comma fill=False comma hatch=slash  slash in single quote&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:38&lt;br /&gt;
| bar  within bracket x comma y comma fill=False comma hatch=in single quote&amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:52&lt;br /&gt;
| bar  within bracket x comma y comma color= in single quote w comma hatch=single quote&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:02&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:06&lt;br /&gt;
| 1. False.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:9&lt;br /&gt;
| Both functions do not produce the same kind of plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:13&lt;br /&gt;
| 2. &amp;lt;tt&amp;gt;bar  within bracket x comma y comma fill=False comma hatch=in single quote&amp;lt;nowiki&amp;gt;|&amp;lt;/nowiki&amp;gt;)&amp;lt;/tt&amp;gt; is the correct option to generate a bar chart with vertical line hatching.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:31&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:34&lt;br /&gt;
|Thank you!&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Plotting-the-data/English-timed</id>
		<title>Python/C2/Plotting-the-data/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Plotting-the-data/English-timed"/>
				<updated>2013-01-02T10:52:51Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello Friends and Welcome to this tutorial on &amp;quot;Plotting Experimental data&amp;quot;.  |- | 0:05 | At the end of this tutorial, you will be a…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello Friends and Welcome to this tutorial on &amp;quot;Plotting Experimental data&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Define a list of numbers.&lt;br /&gt;
# perform element wise squaring of the list.&lt;br /&gt;
# Plot data points.&lt;br /&gt;
# plot errorbars.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:18&lt;br /&gt;
| One needs to be familiar with the concepts of plotting mathematical functions in Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:23&lt;br /&gt;
|We will use data from a Simple Pendulum Experiment to illustrate.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:30&lt;br /&gt;
| As we know for a simple pendulum, length L is directly proportional to the square of time T.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:37&lt;br /&gt;
| We shall be plotting L and T square values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:40&lt;br /&gt;
|First we will have to initiate L and T values. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:44&lt;br /&gt;
|We initiate them as sequence of values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:47&lt;br /&gt;
| We define a sequence by comma separated values inside two square brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:52&lt;br /&gt;
| This is also called a List.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:54&lt;br /&gt;
| Let's create two sequences L and t.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:58&lt;br /&gt;
|L = [0.1, 0.2, 0.3, 0.4, 0.5,0.6, 0.7, 0.8, 0.9] &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:10&lt;br /&gt;
|T= [0.69, 0.90, 1.19,1.30, 1.47, 1.58, 1.77, 1.83, 1.94]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:29&lt;br /&gt;
| To obtain the square of sequence T we will use the function square with argument T.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:36&lt;br /&gt;
|This is saved into the variable Tsquare.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:38&lt;br /&gt;
|So type Tsquare=square withinbracket T&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:55&lt;br /&gt;
|Tsqaure enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:00&lt;br /&gt;
| Now to plot L versus T square, we will simply type&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:07&lt;br /&gt;
|plot within bracket L comma Tsquare comma dot in single quote &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:21&lt;br /&gt;
| dot here displays the plot in a dot pattern. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:26&lt;br /&gt;
|You can also specify 'o' for big dots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:31 &lt;br /&gt;
| For this let us clear the plot first.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:34&lt;br /&gt;
|Type clf bracket enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:39&lt;br /&gt;
|Type plot within bracket L comma Tsquare comma o in single quote enter&lt;br /&gt;
 to clear the bracket type clf bracket&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:01&lt;br /&gt;
| Let us move further.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3.03&lt;br /&gt;
| For any experimental there is always an error in measurements due to instrumental and human constraints.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:10&lt;br /&gt;
| Now we shall try and take these errors into account in our plots .&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:17&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:21&lt;br /&gt;
|Plot the given experimental data with large dots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:25&lt;br /&gt;
| The data is on your screen.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:29&lt;br /&gt;
| Its given in delta underscore L and delta underscore T&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:37&lt;br /&gt;
| We shall again initialize the sequence values in the same manner as we did for L and T.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:48&lt;br /&gt;
| Now to plot L vs T square with an error bar we use the function &amp;lt;tt&amp;gt;errorbar()&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:00&lt;br /&gt;
|Before plotting the data we need to get the data of delta underscore L and delta underscore T&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:05&lt;br /&gt;
|delta underscore L= within square bracket 0.08,0.09,0.07,0.05,0.06,0.00,0.06,0.06,0.01&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:25&lt;br /&gt;
|delta underscore T= [0.04,0.08,0.03,0.05,0.03,0.03,0.04,0.07,0.08]&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:40&lt;br /&gt;
|Now use the error function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:44&lt;br /&gt;
|Type errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt=bo in single quote &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:32&lt;br /&gt;
| This gives a plot with error bar for x and y axis.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:36&lt;br /&gt;
| The dots are of blue color.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:38&lt;br /&gt;
| The parameters xerr and yerr are error on x and y axis and fmt is the format of the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:46&lt;br /&gt;
|similarly we can draw the same error bar with small red dots just change the parameters of fmt to with in single quote r dot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:59&lt;br /&gt;
|Type clf()&lt;br /&gt;
errorbar within bracket L comma Tsquare comma xerr=delta underscore L comma yerr=delta underscore T comma fmt=within r.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:24&lt;br /&gt;
| you can explore other options to errorbar using the documentation of errorbar.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:30&lt;br /&gt;
|errorbar? on terminal&lt;br /&gt;
|-&lt;br /&gt;
| 6:38&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:44&lt;br /&gt;
|Plot the given experimental data with small dots and also include the error in your plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:51&lt;br /&gt;
| The data is on your screen delta s delta n&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:00 &lt;br /&gt;
| This brings us to the end of the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:03&lt;br /&gt;
| In this tutorial, we have learnt to,&lt;br /&gt;
1. to declare a sequence of numbers using the function &amp;lt;tt&amp;gt;array&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:09&lt;br /&gt;
| 2. to perform elementwise squaring using the &amp;lt;tt&amp;gt;square&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:14&lt;br /&gt;
| 3. to use the various options available for plotting like dots,lines.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:20&lt;br /&gt;
| 4. to Plot experimental data such that we can also represent error by using the &amp;lt;tt&amp;gt;errorbar()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:28&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:32&lt;br /&gt;
| 1. Square the following sequence.&amp;lt;br/&amp;gt; &amp;lt;nowiki&amp;gt;distance underscore values=wthin square bracket 2.1 comma 4.6 comma 8.72 comma 9.03 &amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:44&lt;br /&gt;
| 2. Plot L versus T in red pluses.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:52&lt;br /&gt;
| And the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:55&lt;br /&gt;
|1. To square a sequence of values, we use the function &amp;lt;tt&amp;gt;square&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:02&lt;br /&gt;
| Type square within bracket distance underscore values&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:09&lt;br /&gt;
|2. We pass an additional argument stating the desired parameter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:14&lt;br /&gt;
| Type plot within bracket L comma T comma within single quote r+&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:24&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:27&lt;br /&gt;
|Thank You!&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/loading-data-from-files/English-timed</id>
		<title>Python/C2/loading-data-from-files/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/loading-data-from-files/English-timed"/>
				<updated>2013-01-02T10:51:53Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Visual Cue !Narration |- | 0:01 | Hello Friends and Welcome to this tutorial on &amp;quot;loading data from files&amp;quot;.  |- | 0:06 | At the end of this tutorial, you will be able…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Visual Cue&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:01&lt;br /&gt;
| Hello Friends and Welcome to this tutorial on &amp;quot;loading data from files&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Read data from files, containing a single column of data&lt;br /&gt;
# Read multiple columns of data, separated by spaces or other delimiters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:19&lt;br /&gt;
| Let us switch to the terminal and start IPython, using ipython hypen pylab&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:33&lt;br /&gt;
| Now, Let us begin with reading the file primes.txt, which contains a list of prime numbers listed in a column, using the loadtxt command. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:45&lt;br /&gt;
|Please make sure that you provide the correct path of the file, 'primes.txt'. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:50&lt;br /&gt;
|The file, in our case, is present in &amp;lt;tt&amp;gt;slash home slash fossee slash primes.txt&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:59&lt;br /&gt;
| Otherwise we can use the &amp;lt;tt&amp;gt;cat&amp;lt;/tt&amp;gt; command to locate the file and read the contents of it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:05&lt;br /&gt;
|So type cat slash home slash fossee slash primes.txt&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:15&lt;br /&gt;
| Now let us read this list into the variable &amp;lt;tt&amp;gt;primes&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:20&lt;br /&gt;
|So type primes = loadtxt within bracket in single quotes slash home slash fossee slash primes.txt &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:41&lt;br /&gt;
| &amp;lt;tt&amp;gt;primes&amp;lt;/tt&amp;gt; is now a sequence of prime numbers, that was listed in the file,``primes.txt``.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:49&lt;br /&gt;
|We now type, &amp;lt;tt&amp;gt;print space primes&amp;lt;/tt&amp;gt; to see the sequence printed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:00&lt;br /&gt;
| We observe that all the numbers end with a period. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:04&lt;br /&gt;
|This is so, because these numbers are actually read as &amp;lt;tt&amp;gt;floats&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:10&lt;br /&gt;
| Now, let us use the &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; command to read a file &amp;lt;tt&amp;gt;pendulum.txt&amp;lt;/tt&amp;gt; that contains two columns of data.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:19&lt;br /&gt;
| This file contains the length of the pendulum in the first column and the corresponding time period in the second. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:26&lt;br /&gt;
| Note that here &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; needs both the columns to have equal number of rows.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:31&lt;br /&gt;
|We use the &amp;lt;tt&amp;gt;cat&amp;lt;/tt&amp;gt; command to view the contents of this file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:36&lt;br /&gt;
| So type cat slash home slash fossee slash pendulum.txt &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:50&lt;br /&gt;
| Let us, now, read the data into the variable &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:55&lt;br /&gt;
|Again, it is assumed that the file is in &amp;lt;tt&amp;gt;slash home slash fossee&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:02&lt;br /&gt;
|So type pend = loadtxt within bracket in single quote slash home slash fossee slash pendulum.txt &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:21&lt;br /&gt;
| Let us now print the variable &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt; and see what it contains.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:26&lt;br /&gt;
|So type print pend &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  3:31&lt;br /&gt;
| Notice that &amp;lt;tt&amp;gt;pend&amp;lt;/tt&amp;gt; is not a simple sequence like &amp;lt;tt&amp;gt;primes&amp;lt;/tt&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:35&lt;br /&gt;
|It has two sequences, containing both the columns of the data file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:40&lt;br /&gt;
| Let us use an additional argument of the &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; command, to read it into two separate, simple sequences.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:50&lt;br /&gt;
|So type L, T space = space loadtxt within bracket single quoteslash home slash fossee slash pendulum.txt comma unpack=True&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:23&lt;br /&gt;
| Let us now, print the variables L and T, to see what they contain.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:29&lt;br /&gt;
|So type print space L&lt;br /&gt;
print  space T&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:39&lt;br /&gt;
| Notice, that L and T now contain the first and second columns of data from the data file, &amp;lt;tt&amp;gt;pendulum.txt&amp;lt;/tt&amp;gt;, and they are both simple sequences.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:50&lt;br /&gt;
| &amp;lt;tt&amp;gt;unpack=True&amp;lt;/tt&amp;gt; has given us the two columns into two separate sequences instead of one complex sequence.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:00&lt;br /&gt;
| Till now, we have learnt the basic use of the &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:05&lt;br /&gt;
| Let us try an example.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:07&lt;br /&gt;
|Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:12&lt;br /&gt;
|Read the file &amp;lt;tt&amp;gt;pendulum underscore semicolon.txt&amp;lt;/tt&amp;gt; which contains the same data as &amp;lt;tt&amp;gt;pendulum.txt&amp;lt;/tt&amp;gt;, but the columns are separated by semi-colons instead of spaces.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:27&lt;br /&gt;
| Use the IPython help to see how to do this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:34&lt;br /&gt;
|Switch back to the terminal&lt;br /&gt;
&lt;br /&gt;
L comma T = loadtxt within bracket in single quote slash home slash fossee slash pendulum underscore semicolon.txt comma unpack=True comma&lt;br /&gt;
               delimiter=semi-colon within single quote&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:54&lt;br /&gt;
|Okay then type print L&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:40&lt;br /&gt;
|print T&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:45&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:48&lt;br /&gt;
| In this tutorial, we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:51&lt;br /&gt;
| 1. To Read data from files, containing a single column of data using the &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:58&lt;br /&gt;
| 2. To Read multiple columns of data, separated by spaces or other delimiters.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:04&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
1. &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; can read data from a file with one column only. True or False?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:18&lt;br /&gt;
| 2. Given a file &amp;lt;tt&amp;gt;data.txt&amp;lt;/tt&amp;gt; with three columns of data separated by spaces, read it into 3 separate simple sequences.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:29&lt;br /&gt;
| 3. Given a file &amp;lt;tt&amp;gt;data.txt&amp;lt;/tt&amp;gt; with three columns of data separated by &amp;quot;:&amp;quot;, read it into 3 separate simple sequences.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:45&lt;br /&gt;
| And the answers,1. False.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:50&lt;br /&gt;
| &amp;lt;tt&amp;gt;loadtxt&amp;lt;/tt&amp;gt; command can read data from files having both single columns as well as multiple columns.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:58&lt;br /&gt;
| 2. A file with three columns of data separated by spaces to be read into 3 separate sequences, we use the loadtxt command as, x = loadtxt within bracket in double quotes data.txt comma unpack=True&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:19&lt;br /&gt;
| 3. If a file with three columns of data separated by delimiters,we read it into three separate sequences by using an additional argument of delimiter in the loadtxt command&lt;br /&gt;
x = loadtxt within bracket in double quotes data.txt comma unpack=True comma delimiter=in double quotes colon)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:51&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:55&lt;br /&gt;
| Thank you!&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Additional-features-of-IPython/English-timed</id>
		<title>Python/C2/Additional-features-of-IPython/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Additional-features-of-IPython/English-timed"/>
				<updated>2013-01-02T10:50:52Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and welcome to the tutorial on &amp;quot;Additional Features of IPython&amp;quot;.  |- | 0:06 | At the end of this tutorial, you will be ab…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and welcome to the tutorial on &amp;quot;Additional Features of IPython&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Retrieve your ipython history.&lt;br /&gt;
# View a part of the history.&lt;br /&gt;
# Save a part of your history to a file.&lt;br /&gt;
# Run a script from within ipython.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:19&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Embellishing a plot&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:24&lt;br /&gt;
|Let us start ipython with pylab loaded, by typing ipython  hyphen pylab on the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:33&lt;br /&gt;
| We shall first make a plot and then view the history and save it, for that we can type x = linspace within brackets minus 2 into pi comma 2 into pi comma 100&lt;br /&gt;
&lt;br /&gt;
plot within bracket x comma  xsinx within bracket x and hit enter&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:00&lt;br /&gt;
| We got an error saying &amp;quot;xsinx is not defined&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:04&lt;br /&gt;
|This is because xsin(x) is actually x star sin(x), for that we have type in the terminal&lt;br /&gt;
plot within bracket x comma x star sin(x)&lt;br /&gt;
&lt;br /&gt;
plot within bracket x, sin(x)&lt;br /&gt;
xlabel within bracket in double quotes x&lt;br /&gt;
ylabel within bracket in double quotes  dollar sign f(x) dollar sign&lt;br /&gt;
title within bracket in double quotes x and xsin(x)&lt;br /&gt;
title within bracket in double quotes dollar sign x and xsin(x) dollar sign&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:15&lt;br /&gt;
| We now have the plot. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:18&lt;br /&gt;
|Let us look at the commands that we have typed in.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:21&lt;br /&gt;
| The history can be retrieved by using =modulo hist= command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:28&lt;br /&gt;
| Type  modulo that is percentage sign hist in your terminal and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:37&lt;br /&gt;
| As you can see, it displays a list of recent commands that we typed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:41&lt;br /&gt;
| Every command has a number in front, to specify in which order and when it was typed.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:48&lt;br /&gt;
|Please note that there is a percentage sign before the hist command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:52&lt;br /&gt;
| This implies that percentage hist is a command that is specific to IPython only and not to any other version of python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:00&lt;br /&gt;
| These type of commands are called as magic commands.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:04&lt;br /&gt;
|Also note that, the =%hist= itself is a command and is displayed as the most recent command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:15&lt;br /&gt;
| We should note that anything we type in is stored as history, irrespective of whether it is command or an error or IPython magic command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:27&lt;br /&gt;
| If we want only the recent 5 commands to be displayed, we pass the number as an argument to =percentage hist= command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:35&lt;br /&gt;
| Hence percentage hist 5 displays the recent 5 commands, inclusive of the =percentage hist= command. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:46&lt;br /&gt;
|The default number is 40.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:48&lt;br /&gt;
|So to try this we can type in the terminal percentage hist space 5 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:58&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:02&lt;br /&gt;
|Read through the documentation of %hist and find out how to list all the commands between 5 and 10.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:11&lt;br /&gt;
| As we can see from =percentage hist= documentation,percentage hist 5 10 displays the commands from 5 to 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:22&lt;br /&gt;
|Now that we have the history, we will try it on the command prompt so type percentage hist 5 space 10 and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:35&lt;br /&gt;
| we would like to save the required line of code from history.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:39&lt;br /&gt;
| This is possible by using the =percentage save= command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:47&lt;br /&gt;
| Before we do that, let us first look at history and identify what lines of code we require. So type percentage hist and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:58&lt;br /&gt;
| The first command is linspace.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:00&lt;br /&gt;
| But second command is a command that gave us an error.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:06&lt;br /&gt;
| Hence we do not need second command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:09&lt;br /&gt;
| The commands from third to sixth are required. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:12&lt;br /&gt;
|The seventh command although is correct, we do not need it since we are setting the title correctly in the eighth command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:20&lt;br /&gt;
| So we need first third to sixth and the eighth command for our program.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:26&lt;br /&gt;
| Hence you can type in the syntax of percentage save slash home slash fossee slash plot underscore script dot py space 1 space 3 hyphen 6 space 8&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:46&lt;br /&gt;
| The command saves the first line of code and then third to sixth followed by the eighth lines of code into the specified file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:55&lt;br /&gt;
|The first argument to percentage save is the path of file to save the commands and the arguments there after are the commands to be saved in the given order.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:08&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:11&lt;br /&gt;
|Change the label on y-axis to &amp;quot;y&amp;quot; and save the lines of code accordingly.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:17&lt;br /&gt;
| we use the command =ylabel= on interpreter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:21&lt;br /&gt;
|ylabel within brackets in double quotes y and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:29&lt;br /&gt;
| and then you can do percentage save command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:36&lt;br /&gt;
| That is you can type percentage save slash home slash fossee slash example underscore plot dot py space 1 space 3 hyphen 6 space 10&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:51&lt;br /&gt;
| Now that we have the required lines of code in a file, let us learn how to run the file as a python script.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:58&lt;br /&gt;
|We use the IPython magic command =percentage run= to do this. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:03&lt;br /&gt;
|Type percentage run spce hyphen i space slash home slash fossee slash plot underscore script dot py &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:18&lt;br /&gt;
| The script runs but we do not see the plot. This happens because when we are running a script, we are not in the interactive mode anymore.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:27&lt;br /&gt;
|Hence to view the plot type &amp;lt;tt&amp;gt;show then brackets&amp;lt;/tt&amp;gt; on your terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:38&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:41&lt;br /&gt;
|Use percentage hist and percentage save and create a script that has the function show() in it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:49&lt;br /&gt;
| Run the script to produce the plot and display the same.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:56&lt;br /&gt;
|So you can type percentage hist space 20 on the terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:06&lt;br /&gt;
|We first look at the history using this command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:09&lt;br /&gt;
| Then save the script using the command percentage save space  slash home slash fossee slash show underscore included dot py space  1  space 3 hyphen 6  space 8  space 14 space 17&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:37&lt;br /&gt;
| then on the next line you can type&lt;br /&gt;
percentage run hyphen i slash home slash fossee slash show underscore included dot py, then type show function to gt the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:03&lt;br /&gt;
| We get the desired plot now.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:07&lt;br /&gt;
|The reason for including a hyphen i after run is to tell the interpreter that if any name is not found in script, search for it in the interpreter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:17&lt;br /&gt;
|Hence all these sin, plot, pi and show which are not available in script, are taken from the interpreter and used to run the script.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:32&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:36&lt;br /&gt;
|Run the script without using the hyphen i option. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:42&lt;br /&gt;
|Do you find any difference?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:47&lt;br /&gt;
|So you can type percentage run slash home slash fossee slash show underscore included dot py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:04&lt;br /&gt;
| We see that it raises NameError saying that the name linspace is not found.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:12&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:14&lt;br /&gt;
|In this tutorial,we have learnt to, Retrieve the history using =percentage hist= command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:21&lt;br /&gt;
|then View only a part of history by passing an argument to 'percentage hist' command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:25&lt;br /&gt;
|then Save the required lines of code in required order using 'percentage save' command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:30&lt;br /&gt;
|then Use 'percentage run hyphen i' command to run the saved script.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10;39&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:43&lt;br /&gt;
|5. How do you retrieve the recent 5 commands&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:46&lt;br /&gt;
| And there are four options &amp;lt;tt&amp;gt;percentage hist&amp;lt;/tt&amp;gt;,  &amp;lt;tt&amp;gt;percentage hist  minus 5&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;percentage hist 5&amp;lt;/tt&amp;gt;,  &amp;lt;tt&amp;gt;percentage hist 5 to 10&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:57&lt;br /&gt;
|How do you save the lines 2 3 4 5 7 9 10 11 and the options are &amp;lt;tt&amp;gt;percentage save filepath 2 hyphen 5 7 9 hyphen 11&amp;lt;/tt&amp;gt;,  &amp;lt;tt&amp;gt;percentage save filepath 2 hyphen 11&amp;lt;/tt&amp;gt;, &amp;lt;tt&amp;gt;percentage save filepath&amp;lt;/tt&amp;gt;&lt;br /&gt;
 &amp;lt;tt&amp;gt;percentage save 2 hyphen 5 7 9 10 11&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:24&lt;br /&gt;
|And the final question is What will the command &amp;lt;tt&amp;gt;percentage hist 5 10&amp;lt;/tt&amp;gt; display.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:30&lt;br /&gt;
| The recently typed commands from 5 to 10 inclusive of the history command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:34&lt;br /&gt;
|The recently typed commands from 5 to 10 excluding the history command&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:38&lt;br /&gt;
| So now the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:41&lt;br /&gt;
| In order to retrieve the recently typed 5 commands,we say &amp;lt;tt&amp;gt;percentage hist 5&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:49&lt;br /&gt;
|So second question answer is &amp;lt;tt&amp;gt;percentage save filepath 2 hyphen 5 space  7  space 9 hyphen 11&amp;lt;/tt&amp;gt; is the correct option to the specified lines of codes.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:02&lt;br /&gt;
| Then third answer is&amp;lt;tt&amp;gt;percentage hist 5 space 10&amp;lt;/tt&amp;gt; will display the recently typed commands from 5 to 10 inclusive of the history command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:14&lt;br /&gt;
| This brings us to the end of this tutorial&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:17&lt;br /&gt;
|So we Hope you have enjoyed and found it useful.Thank you.&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Multiple-plots/English-timed</id>
		<title>Python/C2/Multiple-plots/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Multiple-plots/English-timed"/>
				<updated>2013-01-02T10:48:35Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and Welcome to this spoken tutorial on &amp;quot;Multiple plots&amp;quot;.  |- | 0:05 | At the end of this tutorial, you will be able to,  …'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello friends and Welcome to this spoken tutorial on &amp;quot;Multiple plots&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:05&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# draw multiple plots which are overlaid.&lt;br /&gt;
# use the figure command.&lt;br /&gt;
# use the legend command&lt;br /&gt;
# switch between the plots and perform some operations on each of them like saving the plots.&lt;br /&gt;
# create and switch between subplots&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:25&lt;br /&gt;
|So, before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Using plot interactively&amp;quot;, &amp;quot;Embellishing a plot&amp;quot; and &amp;quot;Saving plots&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:35&lt;br /&gt;
|To begin with let us start ipython with pylab, by typing ipython space hyphen pylab on the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:51&lt;br /&gt;
| Let us first create set of points for our plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:54&lt;br /&gt;
| For this we will use the command called linspace&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:56&lt;br /&gt;
|So type x is equal to linspace within brackets 0,50,10. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:07&lt;br /&gt;
| Linspace command creates 10 points in the interval between 0 and 50 both inclusive. We assign these values to a variable called x.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:17&lt;br /&gt;
|Now let us draw a simple sine plot using these points&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:20&lt;br /&gt;
|So type plot within brackets x comma sin of x and hit Enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:31&lt;br /&gt;
| Oh! wait!&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
| Is that a good sine plot?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:37&lt;br /&gt;
| Does a sine plot actually look like that? &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:40&lt;br /&gt;
|We know that a sine plot is a smooth curve.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:43&lt;br /&gt;
| Is it not?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:44&lt;br /&gt;
| What really caused this?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:47&lt;br /&gt;
| A small investigation on linspace tells us that we chose too few points in a large interval between 0 and 50 for the curve to be smooth. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:59&lt;br /&gt;
|This also indicates that the plot command actually plots the set of points given by x and sin(x) and it doesn't plot the analytical function itself rather it plots the points given by Analytical functions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:14&lt;br /&gt;
| So now let us use linspace again to get 500 points between 0 and 100 and draw the sine plot again.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:22&lt;br /&gt;
| Now we see a sine plot with a smooth curve.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:26&lt;br /&gt;
| So type y is equal to linspace within brackets 0,50,500. Then type plot within brackets y,sin(y).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:48&lt;br /&gt;
|If we carefully notice we also have two plots now one overlaid upon another. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:55&lt;br /&gt;
|In pylab, by default all the plots are overlaid.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:58&lt;br /&gt;
|Since we have two plots now overlaid upon each other we would like to have a way to indicate what each plot represents to distinguish between them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:06&lt;br /&gt;
| This is accomplished using legends.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:11&lt;br /&gt;
| Equivalently, the legend command does this for us.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:18&lt;br /&gt;
| The legend command takes a single list of parameters where each parameter is the text indicating the plots in the order of their serial number.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:25&lt;br /&gt;
|So we can type on the terminal legend within brackets and in square brackets within single quotes sin of x comma within single quotes sin of y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:44&lt;br /&gt;
| Now we can see the legends being displayed for the respective sine and cosine plots on the plot area.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:52&lt;br /&gt;
| We have learnt quite a lot of things now, so let us take up an exercise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:56&lt;br /&gt;
| Pause the video here,do the exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:02&lt;br /&gt;
|Draw two plots overlaid upon each other, with the first plot being a parabola of the form y is equal to  4into x squared and the second being a straight line of the form y is equalto 2x plus 3 in the interval -5 to 5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:19&lt;br /&gt;
| Use colors to differentiate between the plots and use legends to indicate what each plot is doing.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:26&lt;br /&gt;
| So now,Switch to the terminal for solution. We can obtain the two plots in different colors using the following commands&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:33&lt;br /&gt;
|So type x is equal to linspace within brackets -5 comma 5 comma 100.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:42&lt;br /&gt;
|Then type plot within brackets x, 4 star within brackets x star x, 'b'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:53&lt;br /&gt;
|Then again plot within brackets x, 2 star x plus 3, 'g'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:05&lt;br /&gt;
| Now we can use the legend command as legend within brackets and within square brackets 'Parabola', 'Straight Line'.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:31&lt;br /&gt;
| Or we can also just give the equations of the plot like you can type legend  within brackets and square brackets y = 4 into x squared within single quotes comma within single quotes y is equal to 2x plus 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:49&lt;br /&gt;
| We now know how to draw multiple plots and use legends to indicate which plot represents what function, but we would like to have more control over the plots we draw.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:59&lt;br /&gt;
| Like switch between them, perform some operations or labeling them individually and so on.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:06&lt;br /&gt;
| Let us see how to accomplish this. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:09&lt;br /&gt;
|But before we move on, let us clear our screen. So type clf then closing brackets.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:16&lt;br /&gt;
| To accomplish more control over individual plots we use the figure command. So for that you can type in terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:23&lt;br /&gt;
|x is equal to linspace within brackets 0 comma 50,500.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:29&lt;br /&gt;
|Then type figure within brackets 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:34&lt;br /&gt;
|Then type plot within brackets x, sin(x) comma b and then figure(2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:59&lt;br /&gt;
|Then type x comma cos(x) comma within single quotes g &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:33&lt;br /&gt;
| Now we have two plots, a sine plot and a cosine plot in two different figures.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:39&lt;br /&gt;
| The figure command takes an integer as an argument which is the serial number of the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:43&lt;br /&gt;
| This selects the corresponding plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:45&lt;br /&gt;
| All the plot commands we run hereafter are applied to the selected plot. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:51&lt;br /&gt;
|In this figure 1 is the sine plot and figure 2 is the cosine plot. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:00&lt;br /&gt;
|For example,we can save each plot separately&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:07&lt;br /&gt;
| We also titled our first plot as 'sin(y)' which we did not do for the second plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:14&lt;br /&gt;
|So for that we can type on the terminal savefig within brackets and single quotes slash home slash user slash cosine dot png.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:35&lt;br /&gt;
|Then figure(1).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:42&lt;br /&gt;
|Then title within brackets and single quotes sin(y).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:55&lt;br /&gt;
|Then savefig within brackets and single quotes slash home slash fossee slash sine dot png&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:10&lt;br /&gt;
|In the cosine command also you can use fossee as the user.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:17&lt;br /&gt;
| Let us attempt another exercise problem.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:22&lt;br /&gt;
| Pause here,try to solve the problem and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:26&lt;br /&gt;
|Draw a line of the form y is equal to x as one figure and another line of the form y is equal to 2x plus 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:34&lt;br /&gt;
| Switch back to the first figure,annotate the x and y intercepts.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:39&lt;br /&gt;
| Now switch to the second figure and annotate its x and y intercepts.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:43&lt;br /&gt;
| Save each of them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:46&lt;br /&gt;
| Now, Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:49&lt;br /&gt;
| To solve this problem we should first create the first figure using the figure command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:53&lt;br /&gt;
| Before that, let us first run clf command to make sure all the previous plots are cleared&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:00&lt;br /&gt;
|Then type clf().&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:03&lt;br /&gt;
|Then type figure 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:07&lt;br /&gt;
|Then type x is equal to linspace in brackets -5 comma 5 comma 100.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:14&lt;br /&gt;
|Then plot x comma x.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:22&lt;br /&gt;
| Now use the figure command to create second plotting area and plot the figure&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:27&lt;br /&gt;
|So type figure 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:29&lt;br /&gt;
|Then type plot within brackets x comma within brackets 2 star x plus 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:52&lt;br /&gt;
| Now to switch between the figures we can use figure command. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:56&lt;br /&gt;
|So let us now switch to figure 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:00&lt;br /&gt;
| We are asked to annotate x and y intercepts of the figure 1, but since figure 1 passes through origin,this means, we will have to annotate the origin.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:10&lt;br /&gt;
|We will annotate the intercepts for the second figure and save them as follows.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:14&lt;br /&gt;
|So we can type on the terminal figure 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:21&lt;br /&gt;
|Then type annotate within brackets origin comma xy is equal to 0 point 0 comma 0 point 0.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:30&lt;br /&gt;
|Then figure 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:38&lt;br /&gt;
|So figure 2 . Then annotate within brackets and single quotes x hyphen intercept comma xy is equal to within brackets 0 comma 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:05&lt;br /&gt;
|Then annotate y hyphen intercept comma xy is equal to within brackets 0 comma -1.5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:18&lt;br /&gt;
|You can save figure by typing savefig within brackets and single quotes slash home slash fossee slash plot2 dot png.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:28&lt;br /&gt;
|Then figure 1 and then for saving it we can type savefig within brackets and single quotes slash home slash fossee slash plot1 dot png.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:52&lt;br /&gt;
| At times we run into situations where we want to compare two plots and in such cases we want to draw both the plots in the same plotting area.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:00&lt;br /&gt;
| The situation is such that the two plots have different regular axes which means we cannot draw overlaid plots. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:07&lt;br /&gt;
|In such cases we can draw subplots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:11&lt;br /&gt;
|We use subplot command to accomplish this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:12&lt;br /&gt;
|So we can type subplot within brackets 2 comma 1 comma 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:26&lt;br /&gt;
| As we can see subplot command takes three arguments, the first being the number of rows of subplots that must be created,in this case we have 2 as the first argument so it splits the plotting area horizontally for two subplots. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|13:44&lt;br /&gt;
|The second argument specifies the number of columns of subplots that must be created.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:49&lt;br /&gt;
| We passed 1 as the argument so the plotting area won't be split vertically and the last argument specifies what subplot must be created now in order of the serial number.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:02&lt;br /&gt;
| In this case we passed 1 as the argument, so the first subplot that is top half is created. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:08&lt;br /&gt;
|If we execute the subplot command as you can type on the terminal subplot 2 comma 1 comma 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:19&lt;br /&gt;
| The lower subplot is created.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:23&lt;br /&gt;
| Now we can draw plots in each of the subplot area using the plot command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:26&lt;br /&gt;
|So we can type on the terminal x=linspace within brackets 0 comma 50 comma 500.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:36&lt;br /&gt;
|Then plot within brackets x comma cos(x).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:46&lt;br /&gt;
|Then subplot 2 comma 1 comma 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:54&lt;br /&gt;
|Then y is equal to linspace 0 comma 5 comma 100.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:01&lt;br /&gt;
|Then plot y comma y star star 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:10&lt;br /&gt;
| This created two plots one in each of the subplot area.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:15&lt;br /&gt;
| The top subplot holds a parabola and the bottom subplot holds a cosine curve.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|15:22&lt;br /&gt;
|As seen here we can use subplot command to switch between the subplots as well, but we have to use the same arguments as we used to create that subplot, otherwise the previous subplot at that place will be automatically erased.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:34&lt;br /&gt;
| It is clear from the two subplots that both have different regular axes.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:40&lt;br /&gt;
| For the cosine plot x-axis varies from 0 to 100 and y-axis varies from 0 to 1 where as for the parabolic plot the x-axis varies from 0 to 10 and y-axis varies from 0 to 100.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:54&lt;br /&gt;
| Let us try one more exercise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:56&lt;br /&gt;
| Pause the video here, try out the exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:01&lt;br /&gt;
| We know that the Pressure, Volume and Temperatures are held by the equation PV = nRT where nR is a constant. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16:10&lt;br /&gt;
|Let us assume nR =0.01 Joules/Kelvin and T = 200K.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:19&lt;br /&gt;
| V can be in the range from 21cc to 100cc.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:27&lt;br /&gt;
| Draw two different plots as subplots, one being the Pressure versus Volume plot and the other being Pressure versus Temperature plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:37&lt;br /&gt;
| Switch to the terminal for solution.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 16:41&lt;br /&gt;
| To start with, we have been given the range of Volume using which we can define the variable V&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|16:48&lt;br /&gt;
|V is equal to linspace within brackets 21 comma 100 comma 500.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  16:58&lt;br /&gt;
| Now we can create first subplot and draw Pressure versus Volume graph using this V.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 17:05&lt;br /&gt;
| We know that nRT is a constant which is equal to 2.0 since nR = 0.01 Joules per Kelvin and T = 200 Kelvin&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17:15&lt;br /&gt;
|So we can type on the terminal subplot 2 comma 1 comma 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17:23&lt;br /&gt;
|Then plot within brackets V comma 2 point 0 slash V.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  17:33&lt;br /&gt;
| Now we can create the second subplot and draw the Pressure versus Temperature plot as follows&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17:39&lt;br /&gt;
|subplot 2 comma 1 comma 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|17:44&lt;br /&gt;
|Then type plot within brackets 200 comma 2.0 slash V.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  18:04&lt;br /&gt;
| Unfortunately we have an error now, telling x and y dimensions don't match. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:10&lt;br /&gt;
|This is because our V contains a set of values as returned by linspace and hence 2.0 slash V which is the pressure also contains a set of values.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:20&lt;br /&gt;
| But the first argument to the plot command is a single value.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:23&lt;br /&gt;
| So to plot this data we need to create as many points as there are in Pressure or Volume data for Temperature too, all having the same value.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:34&lt;br /&gt;
| Hence we do this, by typing on the terminal T is equal to linspace within brackets 200 comma 200 comma 500. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 18:48&lt;br /&gt;
| We now have 500 values in T each with the value 200 Kelvin.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:54&lt;br /&gt;
| Plotting this data, we get the required plot&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|18:56&lt;br /&gt;
|So we can type plot within brackets T comma 2 point 0 slash V. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:07&lt;br /&gt;
| This brings us to the end of this tutorial.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:11&lt;br /&gt;
| In this tutorial,we have learnt to, Draw multiple plots which are overlaid.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:15&lt;br /&gt;
| Use the figure command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:16&lt;br /&gt;
|Use the legend command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:18&lt;br /&gt;
|4. Switch between the plots and perform some operations on each of them like saving the plots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:24&lt;br /&gt;
| Create subplots and to switch between them.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:28 &lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:33&lt;br /&gt;
|1. What command is used to get individual plots separately?.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|19:38&lt;br /&gt;
|2. Which of the following is correct. subplot(numRows, numCols, plotNum) , subplot(numRows, numCols) , subplot(numCols, numRows)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 19:59&lt;br /&gt;
| Now we will look at the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:02&lt;br /&gt;
| 1. The command &amp;quot;figure()&amp;quot; can get us the individual plots separately.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:09&lt;br /&gt;
| 2. The subplot command takes three arguments namely the number of rows followed by the number of columns and the plot number. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:17&lt;br /&gt;
|Hence the first option is correct.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|20:19&lt;br /&gt;
|i.e. subplot(numrows,numCols,plotNum)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 20:25&lt;br /&gt;
| So we Hope you have enjoyed and found it useful.&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Saving-plots/English-timed</id>
		<title>Python/C2/Saving-plots/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Saving-plots/English-timed"/>
				<updated>2013-01-02T10:47:38Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello and welcome to the tutorial on &amp;quot;Saving plots&amp;quot;.  |- | 0:04 | At the end of this tutorial, you will be able to,  # Save plots using…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello and welcome to the tutorial on &amp;quot;Saving plots&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:04&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Save plots using &amp;lt;tt&amp;gt;savefig()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
# Save plots in different formats.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:13&lt;br /&gt;
| Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Using plot interactively&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:19&lt;br /&gt;
|Now, &amp;lt;nowiki&amp;gt;Start your IPython interpreter with the command ipython hyphen pylab &amp;lt;Pause&amp;gt;&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:30&lt;br /&gt;
|As you know, it will start your IPython interpreter with the required python modules for plotting and saving your plots.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:36&lt;br /&gt;
| To start with, let us plot a sine wave from minus 3 pi to 3 pi.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:43&lt;br /&gt;
| Let us start by calculating the required points for the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:45&lt;br /&gt;
| It can be done using linspace as,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|0:51&lt;br /&gt;
|Type x = linspace within brackets minus 3 into pi comma 3 into pi comma 100 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:59&lt;br /&gt;
| We have stored the required points in x. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:03&lt;br /&gt;
|Now let us plot the points using the plot statement.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:18&lt;br /&gt;
| Done!&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:19&lt;br /&gt;
| we have made a very basic sine plot, now let us see how to save the plot for future use so that you can embed the plot in your reports.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:32&lt;br /&gt;
| For saving the plot, we will use &amp;lt;tt&amp;gt;savefig()&amp;lt;/tt&amp;gt; function. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|For this we shall keep the plot window open alongside the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:40&lt;br /&gt;
| The statement is,savefig within brackets in single quotes slash home slash fossee slash sine dot png&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:52&lt;br /&gt;
| Notice that &amp;lt;tt&amp;gt;savefig&amp;lt;/tt&amp;gt; function takes one argument which is the filename, the last 3 characters after the &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; in the filename is the extension and type of the file which determines the format in which you want to save.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:10&lt;br /&gt;
| Also, note that we gave the full path or the absolute path to which we want to save the file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:18&lt;br /&gt;
| Here we have used an extension &amp;lt;tt&amp;gt;dot png&amp;lt;/tt&amp;gt; which means we want to save the image as a PNG file.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
|Now let us locate the file &amp;lt;tt&amp;gt;sine dot png&amp;lt;/tt&amp;gt; which we had saved a while ago.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:32&lt;br /&gt;
| We have saved the file to &amp;lt;tt&amp;gt; slash home slash fossee&amp;lt;/tt&amp;gt; so let us navigate to &amp;lt;tt&amp;gt;slash home slash fossee&amp;lt;/tt&amp;gt; using thefile browser.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:49&lt;br /&gt;
| Yes, the file &amp;lt;tt&amp;gt;sine dot png&amp;lt;/tt&amp;gt; is here. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:52&lt;br /&gt;
|Let us open it and check.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:57&lt;br /&gt;
| So in-order to save a plot, we use &amp;lt;tt&amp;gt;savefig&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:05&lt;br /&gt;
| &amp;lt;tt&amp;gt;dot savefig&amp;lt;/tt&amp;gt; can save the plot in many formats, such as pdf - portable document format, ps - post script, eps - encapsulated post script, svg - scalable vector graphics, png - portable network graphics which support transparency etc.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:24&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|3:29&lt;br /&gt;
|Save the sine plot in the EPS format which can be embedded in LaTeX documents.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:37&lt;br /&gt;
| We still have the sine plot with us,let us now save the plot as &amp;lt;tt&amp;gt;sine dot eps&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:49&lt;br /&gt;
| Now, We will save the plot using the function &amp;lt;tt&amp;gt;savefig&amp;lt;/tt&amp;gt;, so you can type savefig within brackets in single quotes slash home slash fossee slash sine dot eps and hit enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  4:04&lt;br /&gt;
| Now let us go to &amp;lt;tt&amp;gt;slash home slash fossee&amp;lt;/tt&amp;gt; and see the new file created.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:13&lt;br /&gt;
| Yes! the new file &amp;lt;tt&amp;gt;sine dot eps&amp;lt;/tt&amp;gt; is here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:18&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:23&lt;br /&gt;
|Save the sine plot in PDF, PS and SVG formats.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:31&lt;br /&gt;
| This brings us to the end of this tutorial. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:34&lt;br /&gt;
|In this tutorial,we have learnt to, Save plots using the &amp;lt;tt&amp;gt;savefig()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:38&lt;br /&gt;
| then Save the plots in different formats like - pdf - ps - png - svg - eps&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:45&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:48&lt;br /&gt;
|1. Which command is used to save a plot. saveplot() savefig() savefigure() saveplt()&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:59&lt;br /&gt;
| 2. &amp;lt;tt&amp;gt;savefig('sine.png')&amp;lt;/tt&amp;gt; saves the plot in,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:04&lt;br /&gt;
| The root directory &amp;lt;tt&amp;gt;/&amp;lt;/tt&amp;gt; (on GNU/Linux, Unix based systems), &amp;lt;tt&amp;gt;c colon slash &amp;lt;/tt&amp;gt; (on windows).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:14&lt;br /&gt;
| The second option. Will result in an error as full path is not supplied.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:18&lt;br /&gt;
| The third one.The current working directory.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:21&lt;br /&gt;
| and final option is Predefined directory like &amp;lt;tt&amp;gt;/documents&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:26&lt;br /&gt;
| And now, the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:28&lt;br /&gt;
|1.To save a plot,we use the &amp;lt;tt&amp;gt;savefig()&amp;lt;/tt&amp;gt; function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|2. Whenever we save a file,it gets saved in the current working directory.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:38&lt;br /&gt;
| Hope you have enjoyed and found it useful.&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Embellishing-a-plot/English-timed</id>
		<title>Python/C2/Embellishing-a-plot/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Embellishing-a-plot/English-timed"/>
				<updated>2013-01-02T10:46:45Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |-  |  0:00 | Welcome to the tutorial on &amp;quot;Embellishing a Plot&amp;quot;.  |- | 0:06 | At the end of this tutorial, you will be able to,  # Modify the attrib…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
&lt;br /&gt;
|  0:00&lt;br /&gt;
| Welcome to the tutorial on &amp;quot;Embellishing a Plot&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Modify the attributes of the plot -- color, line style,linewidth.&lt;br /&gt;
# Add a title to the plot with embedded LaTeX.&lt;br /&gt;
# Label x and y axes.&lt;br /&gt;
# Add annotations to the plot.&lt;br /&gt;
# Set and Get the limits of axes.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:27&lt;br /&gt;
| So, Before beginning this tutorial,we would suggest you to complete the tutorial on &amp;quot;Using plot interactively&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:34&lt;br /&gt;
| so,let us start ipython with pylab loaded, open the terminal and type ipython hyphen pylab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:48&lt;br /&gt;
| We shall first make a simple plot and start decorating it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:54&lt;br /&gt;
|So type x is equal to linspace within brackets -2,4,20&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:06&lt;br /&gt;
|then type plot(x,sin(x))&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:15&lt;br /&gt;
| As we can see, the default colour and the default thickness of the line is as decided by pylab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:23&lt;br /&gt;
| Wouldn't it be nice if we could control these parameters in the plot? &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:28&lt;br /&gt;
|This is possible by passing additional arguments to the plot command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:33&lt;br /&gt;
| We shall first clear the figure and plot the same by passing the additional color argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:39&lt;br /&gt;
| Pass the argument 'r' for red color.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:44&lt;br /&gt;
| So type clf, then plot within brackets x,sin(x),within single quotes r.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  2:13&lt;br /&gt;
| The same plot is seen in red color.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:16&lt;br /&gt;
| The thickness of the line can be altered by 'linewidth' argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:20&lt;br /&gt;
|So type plot within brackets x,cos(x),linewidth is equal to 2&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:34&lt;br /&gt;
|Now, a plot with line thickness 2 is produced.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:40&lt;br /&gt;
| Pause the video and do this exercise and then resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:45&lt;br /&gt;
|Plot sin(x) in blue color along with linewidth as 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:53&lt;br /&gt;
| So, now switch to terminal for solution A combination of color and linewidth would do the job for us.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:01&lt;br /&gt;
|So , type clf , then type plot within brackets x, sin(x),within single quotes b,linewidth is equal to 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:16&lt;br /&gt;
| To get the style of line as bunch of points not joined, pass the linestyle argument with or without color argument.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:25&lt;br /&gt;
| So for that type on the terminal clf, then type  plot x,sin(x),within single quotes dot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:43&lt;br /&gt;
| We get a plot with only points.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:49&lt;br /&gt;
| To get the same plot in blue color type clf, then type plot within brackets x, sin(x),within single quotes b dot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:02&lt;br /&gt;
| Other available options for passing arguments can be seen in the documentation of plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:07&lt;br /&gt;
|For that , you can type in the terminal plot then question mark.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:19&lt;br /&gt;
| So, you can actually go through the documentation.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:23&lt;br /&gt;
| So , you pause the video and do this exercise and then resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:28&lt;br /&gt;
|Plot the sine curve with green filled circles.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:33&lt;br /&gt;
| so ,for solutionNow, switch to terminal . We use a combination of linestyle and color.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:40&lt;br /&gt;
|So ,type clf() then type plot within brackets x,cos(x), within single quotes go.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:56&lt;br /&gt;
|So, Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:02&lt;br /&gt;
|Plot the curve of x versus tan(x) in red dash line and linewidth 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:13&lt;br /&gt;
| So for solution, we will switch to terminal . &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:18&lt;br /&gt;
|Here we shall use a combination of linewidth argument and linestyle.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:22&lt;br /&gt;
|So in terminal you can type clf() then plot within brackets x, cos(x), within single quotes r hyphen hyphen&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:36&lt;br /&gt;
| Now that we know how to produce a bare minimum plot with color, style and thickness of our interest, we shall look at further decorating the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  5:46&lt;br /&gt;
| Let us start with a plot for the function minus x squared plus  4x minus  5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|5:52&lt;br /&gt;
|So for that you have to type clf then plot within brackets x,minus x star x plus 4 star x minus 5,'r',linewidth is equal to 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:16&lt;br /&gt;
| As you can see, the figure does not have any description describing the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:21&lt;br /&gt;
|To add a title to the plot to describe what the plot is,use the &amp;lt;tt&amp;gt;title&amp;lt;/tt&amp;gt; command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:26&lt;br /&gt;
|So, we can type in the terminal title within brackets and double quotes Parabolic function - x squared plus  4x minus 5&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:42&lt;br /&gt;
|The figure now has a title.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|6:45&lt;br /&gt;
| But it is not formatted and does not look clean.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:49&lt;br /&gt;
| It would look shabby if there were fractions and more complex functions like log and exp.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:57&lt;br /&gt;
| So, Wouldn't it be good if the title is seen in LaTeX like formatting?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:03&lt;br /&gt;
| This is possible by adding a &amp;lt;tt&amp;gt;$&amp;lt;/tt&amp;gt; sign before and after the part of the string that should be in LaTeX style.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:10&lt;br /&gt;
| So in the command you can type title within brackets and double quotes Parabolic function dollar sign minus x squared plus 4x minus 5 dollar sign&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:26&lt;br /&gt;
| As we can see, the polynomial is now formatted.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:30&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:35&lt;br /&gt;
| Change the title of the figure such that the whole title is formatted in LaTeX style.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:41&lt;br /&gt;
| Switch to terminal for solution. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:45&lt;br /&gt;
| The solution is to enclose the whole string in between $.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|7:51&lt;br /&gt;
|So you can type title within brackets dollar sign Parabolic function -x squared plus 4x minus 5 dollar sign.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:01&lt;br /&gt;
| Although we have title, the plot is not complete without labelling x and y axes. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:05&lt;br /&gt;
| we shall label x-axis to &amp;quot;x&amp;quot; and y-axis to &amp;quot;f(x)&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:12&lt;br /&gt;
|So for that you can type in terminal xlabel within brackets in double quotes x , then in terminal ylabel within brackets in double quotes f of x.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:31&lt;br /&gt;
| As you can see, &amp;lt;tt&amp;gt;xlabel&amp;lt;/tt&amp;gt; and 'ylabel' command takes a string as an argument. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:37&lt;br /&gt;
| xlabel sets the label to x-axis as 'x' and ylabel sets the name to the y-axis as 'f(x)'.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:50&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:57&lt;br /&gt;
| Set the x and y labels as &amp;quot;x&amp;quot; and &amp;quot;f(x)&amp;quot; in LaTeX style.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:04&lt;br /&gt;
| Since we need LaTeX style formatting, all we have to do is enclose the string in between two $.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:10&lt;br /&gt;
| Switch to terminal for solution and type xlabel within brackets dollar sign x dollar sign.&lt;br /&gt;
ylabel within brackets and double quotes dollar sign f of x dollar sign.&lt;br /&gt;
 &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:31&lt;br /&gt;
| The plot is now almost complete except that the points are not named.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:37&lt;br /&gt;
| For example the point (2, -1) is the local maxima.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:42&lt;br /&gt;
| We would like to name the point accordingly. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:47&lt;br /&gt;
|To do this use the function &amp;lt;tt&amp;gt;annotate&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|9:49&lt;br /&gt;
|So for that you can type in the terminal annotate within brackets in double quotes local maxima comma xy is equal to within brackets 2 comma -1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:04&lt;br /&gt;
| As you can see, the first argument to &amp;lt;tt&amp;gt;annotate&amp;lt;/tt&amp;gt; command is the name we would like to mark the point as, and the second argument is the co-ordinates of the point at which the name should appear.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:18&lt;br /&gt;
| It is a tuple containing two numbers.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:20&lt;br /&gt;
| The first is x co-ordinate and second is y co-ordinate.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:25&lt;br /&gt;
| Pause the video, do this exercise and then resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:30&lt;br /&gt;
|Make an annotation called &amp;quot;root&amp;quot; at the point (-4, 0).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:38&lt;br /&gt;
| What happens to the first annotation ?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:43&lt;br /&gt;
| Switch to the terminal for the solution. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:46&lt;br /&gt;
|As we can see, every annotate command makes a new annotation on the figure.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|10:52&lt;br /&gt;
|Now we have everything we need to decorate a plot, but the plot would be incomplete if we can not set the limits of axes. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:01&lt;br /&gt;
|This can be done using the button provided on the plot window.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:06&lt;br /&gt;
|Else limits also can be get and set from the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:13&lt;br /&gt;
| Use &amp;quot;xlim()&amp;quot; and &amp;quot;ylim()&amp;quot; functions to get the limits.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:17&lt;br /&gt;
|So type in the terminal annotate within brackets in double quotes root comma xy is equal to within brackets minus 4 comma 0.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:32&lt;br /&gt;
| &amp;lt;tt&amp;gt;xlim&amp;lt;/tt&amp;gt; function returns the current x axis limits and &amp;lt;tt&amp;gt;ylim&amp;lt;/tt&amp;gt; function returns the current y-axis limits.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:41&lt;br /&gt;
|Set the limits of x-axis from -4 to 5 by giving command xlim(-4,5).&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  12:12&lt;br /&gt;
| Similarly set the limits of y-axis appropriately.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:22&lt;br /&gt;
| Pause the video, do this exercise and then resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:27&lt;br /&gt;
|Set the limits of axes such that the area of interest is the rectangle (-1, -15) and (3, 0)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 12:37&lt;br /&gt;
| Switch to the terminal for the solution. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:40&lt;br /&gt;
|As we can see, the lower and upper limits of x-axis in the exercise are -1 and 3 respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:46&lt;br /&gt;
| The lower and upper limits of y-axis are -15 and 0 respectively.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|12:51&lt;br /&gt;
|So in the command we can type xlim within brackets -1 comma 3 and ylim within brackets -15 comma 0.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:02&lt;br /&gt;
| This gives us the required rectangle.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:09&lt;br /&gt;
| This brings us to the end of this tutorial.In this tutorial,we have learnt to,Modify the attributes of plot like color, line width, line style by passing additional arguments.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:20&lt;br /&gt;
|  Add title to a plot using 'title' command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:24&lt;br /&gt;
|  Incorporate LaTeX style formatting by adding a &amp;lt;tt&amp;gt;$&amp;lt;/tt&amp;gt; sign before and after the part of the string.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:30&lt;br /&gt;
|  Label x and y axes using xlabel() and ylabel() commands.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:36&lt;br /&gt;
| Then, add annotations to a plot using annotate() command.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:38&lt;br /&gt;
| Get and set the limits of axes using xlim() and ylim() commands.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:46&lt;br /&gt;
| Here are some self assessment questions for you to solve.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:50&lt;br /&gt;
| 1. Draw a plot of cosine graph between -2pi to 2pi with line thickness 4.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 13:57&lt;br /&gt;
| 2. Read through the documentation and find out, is there a way to modify the alignment of text in the command &amp;lt;tt&amp;gt;ylabel&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:05&lt;br /&gt;
| Yes or No are the options.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:07&lt;br /&gt;
| And the final question. How do you set the title as x^2-5x+6 in LaTex style formatting.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:15&lt;br /&gt;
| Now, the answers,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:20&lt;br /&gt;
| 1. In order to plot a cosine graph between the points -2pi and 2pi with line thickness 3,we use the &amp;lt;tt&amp;gt;linspace&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;plot&amp;lt;/tt&amp;gt; command as, x = linspace(-2*pi, 2*pi)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:41&lt;br /&gt;
| then plot(x, cos(x), linewidth=4)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 14:46&lt;br /&gt;
| And the second answer is No. We do not have an option to modify the alignment of text in the command &amp;lt;tt&amp;gt;ylabel&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|14:53&lt;br /&gt;
| Then the third and final one. To set the title in LaTex style formatting,we write the equation between two dollar signs as,&lt;br /&gt;
&lt;br /&gt;
 title(&amp;quot;$x^2-5x+6$&amp;quot;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 15:11&lt;br /&gt;
| Hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Using-the-plot-command-interactively/English-timed</id>
		<title>Python/C2/Using-the-plot-command-interactively/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Using-the-plot-command-interactively/English-timed"/>
				<updated>2013-01-02T10:45:52Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Visual Cue |- | 0:00 | Hello Friends and welcome to the tutorial on creating simple plots using iPython.  |- | 0:06 | I hope you have IPython running on your…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Visual Cue&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
| Hello Friends and welcome to the tutorial on creating simple plots using iPython.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| I hope you have IPython running on your computer.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:10&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# Create simple plots of mathematical functions.&lt;br /&gt;
# Use the Figure window to study plots better.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:20&lt;br /&gt;
| Lets start ipython.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:22&lt;br /&gt;
| Open the terminal and type ipython -pylab and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:35&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;Pylab is a python library which provides plotting functionality&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:39&lt;br /&gt;
| It provides many other important mathematical and scientific functions.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:43&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;After running IPython -pylab in the shell you will see some information about ipython and pylab followed by the In[1] prompt&amp;lt;/nowiki&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:55&lt;br /&gt;
| But if you get an error like `ERROR: matplotlib could NOT be imported!  Starting normal IPython.`&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:02&lt;br /&gt;
|Then you will have to install the matplotlib and run this command again.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:08&lt;br /&gt;
| Now type 'linspace' followed by a '?' mark in your ipython shell&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  1:19&lt;br /&gt;
| as the documentation says, it returns ''num'' evenly spaced samples, calculated over the interval start and stop.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:29&lt;br /&gt;
| To illustrate this, lets try to generate 100 points.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:33&lt;br /&gt;
| Type &amp;lt;tt&amp;gt;linspace within brackets 1 comma 100 comma 100 &amp;lt;/tt&amp;gt; and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:47&lt;br /&gt;
| As you can see a sequence of numbers from 1 to 100 appears.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:52&lt;br /&gt;
| Now lets try to generate 200 points between 0 and 1.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|1:57&lt;br /&gt;
|we do that by typing linspace within brackets 0 comma 1 comma 200.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:11&lt;br /&gt;
| Here,0 is the start , 1 the stop and 200 the number of points.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:18&lt;br /&gt;
| In linspace the start and stop points can be integers, decimals , or constants. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:24&lt;br /&gt;
|Let's try and get 100 points between  minus pi to pi.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:30&lt;br /&gt;
| Here 'pi' is a constant defined by pylab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:34&lt;br /&gt;
| Save this to the variable,say p.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:52&lt;br /&gt;
| If we now type &amp;lt;tt&amp;gt;len within brackets p&amp;lt;/tt&amp;gt; we will get the no. of points.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:05&lt;br /&gt;
| &amp;lt;tt&amp;gt;len&amp;lt;/tt&amp;gt; function gives the no of elements of a sequence.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:11&lt;br /&gt;
| Let's try and plot a cosine curve between minus pi and pi. For this we use the plot command. Here cos(p) gets the cosine value at every point corresponding to point p.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:50&lt;br /&gt;
| We can save cos(p) to variable cosine and then plot it using the plot function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:57&lt;br /&gt;
| Now to clear the plot ,we use the &amp;lt;tt&amp;gt;clf closing brackets&amp;lt;/tt&amp;gt; function&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:19 &lt;br /&gt;
| This is done because if we wish to make another plot, it will overlap the previous plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:25&lt;br /&gt;
| As we do not wish to clutter the area with overlaid plots , we just clear it with clf(). &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|4:34&lt;br /&gt;
|Now lets try a sine plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:04&lt;br /&gt;
| We can study the plot better on the plot window by using the various options available on it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:11&lt;br /&gt;
| Let us have a look at these options.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:14&lt;br /&gt;
| As we can observe, moving the mouse pointer along the plot gives us the location of each point on the plot&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:26&lt;br /&gt;
| To the bottom left of the window,there are a few buttons. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:30&lt;br /&gt;
|The right most among them is for saving the file. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:35&lt;br /&gt;
|Just click on it and type the file name. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:48&lt;br /&gt;
|We will save the plot by the name ''sin_curve'' in pdf format.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:00&lt;br /&gt;
| As you can see we can specify the format of file from the dropdown. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:05&lt;br /&gt;
|Formats like png ,eps ,pdf, ps are available.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:17&lt;br /&gt;
| Left to the save button is the slider button by which we can specify the margins.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:25&lt;br /&gt;
| Left to this is the zoom button by which we can zoom into the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:30&lt;br /&gt;
| Just specify the region to zoom into.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:40&lt;br /&gt;
| The button to the left of it can be used to move the axes of the plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:50&lt;br /&gt;
| The next two buttons with left and right arrow icons change the state of the plot and take it to the previous state it was in.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:00&lt;br /&gt;
| It more or less acts like the back and forward button in a browser.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:06&lt;br /&gt;
| The last one is 'home' referring to the initial plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:13&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:20&lt;br /&gt;
|Plot (sin(x) into sin(x)) by x.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:26&lt;br /&gt;
| 1. Save the plot by the sin square by x.pdf in pdf format.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:33&lt;br /&gt;
| Second one. Zoom and find the maxima.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:37&lt;br /&gt;
| 3. Bring it back to initial position.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:44&lt;br /&gt;
| Now, lets revise quickly what we have learnt today.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:49&lt;br /&gt;
|To Study Ipython with pylab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:52&lt;br /&gt;
| To Use the linspace function to create ''num'' equally spaced points in a region.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:57&lt;br /&gt;
|To Find the length of sequences using len function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:01&lt;br /&gt;
| Plot mathematical functions using plot.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:05&lt;br /&gt;
| To clear drawing area using clf.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:08&lt;br /&gt;
| To Use the UI of plot for studying it better and using functionality like save,zoom and moving the plots on x and y axis.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:23&lt;br /&gt;
| Create 100 equally spaced points between minus pi by 2 and pi by 2?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:31&lt;br /&gt;
|Second one is. How do you clear a figure in ipython?&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:36&lt;br /&gt;
|The third one. How do you find the length of a sequence?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:43&lt;br /&gt;
| And the answers are,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:45&lt;br /&gt;
|1.We use the command ''linspace within brackets minus pi by 2 comma pi by 2 comma 100'' to create 100 equally spaced lines between the points minus pi by 2 and pi by 2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:03&lt;br /&gt;
|Second one. We use clf closing bracket function to clear a figure.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:11&lt;br /&gt;
|Third one. ''len within brackets sequence_name'' is the function used to find out the length of a sequence.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:20&lt;br /&gt;
| Hope you have enjoyed and found it useful.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:24&lt;br /&gt;
| Thank you!&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/Python/C2/Getting-started-with-ipython/English-timed</id>
		<title>Python/C2/Getting-started-with-ipython/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/Python/C2/Getting-started-with-ipython/English-timed"/>
				<updated>2013-01-02T10:44:44Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Timing !Narration |- | 0:00  | Hello Friends and Welcome to the tutorial on &amp;quot;getting started with &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt;&amp;quot;.  |- | 0:06 | At the end of this tutorial, you wi…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Timing&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
| 0:00&lt;br /&gt;
&lt;br /&gt;
| Hello Friends and Welcome to the tutorial on &amp;quot;getting started with &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt;&amp;quot;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:06&lt;br /&gt;
| At the end of this tutorial, you will be able to,&lt;br /&gt;
&lt;br /&gt;
# invoke the &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; interpreter .&lt;br /&gt;
# quit the &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; interpreter.&lt;br /&gt;
# navigate the &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; session history.&lt;br /&gt;
# use tab-completion for writing ipython functions.&lt;br /&gt;
# look-up documentation of functions.&lt;br /&gt;
# interrupt incomplete or incorrect commands.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  0:26&lt;br /&gt;
| IPython is an enhanced Python interpreter that provides features like tab-completion, easier access to help and many other functionalities.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:36&lt;br /&gt;
|Let us first see how to start the &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:40&lt;br /&gt;
| First open the terminal, type &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; in the terminal and hit enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:50&lt;br /&gt;
| &amp;lt;nowiki&amp;gt;After getting some information about the version of Python installed and some help commands, we get a prompt with In[1]:.&amp;lt;/nowiki&amp;gt; &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 0:59&lt;br /&gt;
|But, if you get an error saying 'ipython is not installed' then refer to the tutorial on how to install the packages.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:07&lt;br /&gt;
| Now, lets see how we can quit the ipython interpreter, press Ctrl-D.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:17&lt;br /&gt;
| A prompt will appear to confirm whether you really want to exit, type y to say yes and quit ipython and n to say no if you don't want to quit the ipython. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:27&lt;br /&gt;
| Press y.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:31&lt;br /&gt;
| Now since we have quit the interpretor, let us start it again by typing &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:41 &lt;br /&gt;
| And now let's see, how to use the interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:45&lt;br /&gt;
|Start with the simplest thing, addition.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:48&lt;br /&gt;
|type 1+2 at the prompt. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:54&lt;br /&gt;
|IPython promptly gives back the output as 3. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 1:58&lt;br /&gt;
|Notice that the output is displayed with an &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;Out[1]&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; indication.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:05&lt;br /&gt;
| Now, Let us now try few more operations such as, 5 minus 3, 7 minus 4, 6 into 5.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:22&lt;br /&gt;
| Now let's see how the ipython remembers the history of commands. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:28&lt;br /&gt;
|For example &amp;lt;tt&amp;gt;print 1+2&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:32&lt;br /&gt;
|Instead of typing the whole thing,use the up arrow key to go back to the command &amp;lt;tt&amp;gt;1+2&amp;lt;/tt&amp;gt; which we did before, now use the left-arrow key to navigate to the beginning of the line and type the word``print``and press space.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 2:54&lt;br /&gt;
| We have changed the line to print 1+2, now press enter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:01&lt;br /&gt;
|The interpreter prints the result as 3.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:04&lt;br /&gt;
| Please note that the indication Out square brackets is not shown here.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:10&lt;br /&gt;
| Now let us do print 10 into 2. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:14&lt;br /&gt;
|We use the up arrow key to navigate to the previous command 1+2.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:21&lt;br /&gt;
| Now change &amp;lt;tt&amp;gt;1 plus 2&amp;lt;/tt&amp;gt; to &amp;lt;tt&amp;gt;10 into 2&amp;lt;/tt&amp;gt; and press enter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:33&lt;br /&gt;
| Till now, we saw how to invoke the ipython interpreter,quit the ipython and navigate through previous commands in ipython. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:41&lt;br /&gt;
|Now, let's see, what is tab-completion?. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:45&lt;br /&gt;
|let's take an example, suppose we want to use the function &amp;lt;tt&amp;gt;round&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:50&lt;br /&gt;
| For this we just type &amp;lt;tt&amp;gt;ro&amp;lt;/tt&amp;gt; at the prompt and press the tab key.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 3:59&lt;br /&gt;
| As you can see on the terminal, IPython completes the command &amp;lt;tt&amp;gt;ro&amp;lt;/tt&amp;gt; into round, This feature of ipython is called the tab-completion.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:08&lt;br /&gt;
| Let's see some more possibilities of tab completion just type &amp;lt;tt&amp;gt;r&amp;lt;/tt&amp;gt; and then press the tab.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:18&lt;br /&gt;
| As you can see that IPython does not complete the command. This is because, there are many possibilities of &amp;lt;tt&amp;gt;r&amp;lt;/tt&amp;gt; therefore it just lists out all the possible completions of r.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:30&lt;br /&gt;
| Now let's try out an exercise.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:32&lt;br /&gt;
| Pause the video,solve the problem and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:38&lt;br /&gt;
| 1. find out the commands starting with &amp;quot;ab&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:43&lt;br /&gt;
| 2. list out the commands starting with &amp;quot;a&amp;quot;?&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 4:53&lt;br /&gt;
| &amp;lt;tt&amp;gt;ab&amp;lt;/tt&amp;gt; tab completes to &amp;lt;tt&amp;gt;abs&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;&amp;lt;nowiki&amp;gt;a&amp;lt;tab&amp;gt;&amp;lt;/nowiki&amp;gt;&amp;lt;/tt&amp;gt; gives us a list of all the commands starting with a.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:06&lt;br /&gt;
| Now, let's see what the functions abs is used for.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:11&lt;br /&gt;
| We will use the help features of ipython to find out this.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:15&lt;br /&gt;
| To see the documentation of a function, type the function name followed by a exercise mark.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:23&lt;br /&gt;
| Ipython interpreter will show the documentation for the function.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:27&lt;br /&gt;
| Let us see the documentation of the function abs, type abs? and press enter&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:37&lt;br /&gt;
| As the documentation says, &amp;lt;tt&amp;gt;abs&amp;lt;/tt&amp;gt; accepts a number as an input and returns it's absolute value.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:45&lt;br /&gt;
|lets see few examples,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 5:48&lt;br /&gt;
|Type abs(-19) and abs(19) on the interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:03&lt;br /&gt;
|We get 19, as expected, in both the cases.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:07 &lt;br /&gt;
| Now lets try it for decimal numbers; lets try abs(-10.5), we got 10.5 as the result.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:23&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:30&lt;br /&gt;
|Look-up the documentation of &amp;lt;tt&amp;gt;round&amp;lt;/tt&amp;gt; and see how to use it.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:38&lt;br /&gt;
| And you can look up the documentation of the function round by typing round exercise mark in the ipython interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:47&lt;br /&gt;
| If you notice, there are extra square brackets around &amp;lt;tt&amp;gt;ndigits&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:52&lt;br /&gt;
| This means that &amp;lt;tt&amp;gt;ndigits&amp;lt;/tt&amp;gt; is optional and 0 is the default value.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 6:57&lt;br /&gt;
| Optional parameters are shown in square brackets in Python documentation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:02&lt;br /&gt;
|The function &amp;lt;tt&amp;gt;round&amp;lt;/tt&amp;gt;, rounds a number to a given precision.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:08&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:15&lt;br /&gt;
| et us now try few more examples with the function round.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:19&lt;br /&gt;
| Check the output of round(2.48) round(2.48, 1) round(2.48, 2) round(2.484) round(2.484, 1) round(2.484, 2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:42&lt;br /&gt;
| Now, we get 2.0, 2.5 and 2.48, which are what we expect.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:54&lt;br /&gt;
| Let's now see how to correct typing errors which we often make while typing at the terminal.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:59&lt;br /&gt;
| As already shown, if we haven't hit the enter key already, we could navigate using the arrow keys and make deletions using delete or backspace key and correct the errors.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:11&lt;br /&gt;
|let us make a typing error deliberately, type round(2.484 and hit enter, without closing the parenthesis.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:24&lt;br /&gt;
| We get a prompt with dots. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:27&lt;br /&gt;
|This prompt is the continuation prompt of &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:31&lt;br /&gt;
| It appears when, the previous line is incomplete.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:35&lt;br /&gt;
| now complete the command of the same examples with close parenthesis and press enter. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|8:48&lt;br /&gt;
|We got the expected output that is 2.0&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 8:51&lt;br /&gt;
| In other instances, if we commit a typing error with a longer and more complex expression and end up with the continuation prompt, we can type Ctrl-C to interrupt the command and to get back to the &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; input prompt.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:15&lt;br /&gt;
| Pause the video here, try out the following exercise and resume the video.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:22&lt;br /&gt;
| 1. type round(2.484, and press enter. and then cancel the command using Ctrl-C.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 9:45&lt;br /&gt;
| 2. type the command, round(2.484, 2)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:08&lt;br /&gt;
| Now, let us revise quickly what we learnt today. In this tutorial,we have learnt to,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:15&lt;br /&gt;
| 1. Invoke the &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; interpreter by typing ipython.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:18&lt;br /&gt;
| 2. To quit the &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt;&amp;lt;nowiki&amp;gt; interpreter by using &amp;lt;ctrl&amp;gt;d.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:22&lt;br /&gt;
| 3. To navigate in the history of &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt; by using the arrow keys.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:28&lt;br /&gt;
| 4. What is tab-completion &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:29&lt;br /&gt;
| 5. To see the documentation of functions using exercise mark.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:32&lt;br /&gt;
| 6.  To &amp;lt;nowiki&amp;gt;Interrupt using &amp;lt;ctrl&amp;gt;c when we make an error.&amp;lt;/nowiki&amp;gt;&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:37&lt;br /&gt;
| Here are some self assessment questions for you to solve&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:42&lt;br /&gt;
|  &amp;lt;tt&amp;gt;'''ipython&amp;lt;/tt&amp;gt; is a programming language similar to Python.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:50&lt;br /&gt;
|'''&amp;lt;br/&amp;gt; True or False&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 10:52&lt;br /&gt;
| Second one. Which key combination quits &amp;lt;tt&amp;gt;ipython&amp;lt;/tt&amp;gt;?  Ctrl + C Ctrl + D Alt + C Alt + D&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:02&lt;br /&gt;
| The last one. Which character is used at the end of a command, in Ipython to display the documentation. under score (_) exercise mark (?) exclamation mark (!) ampersand (&amp;amp;)&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:15 &lt;br /&gt;
| And the answers are,&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:18&lt;br /&gt;
| Ipython is not a programming language, it is just an interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:22&lt;br /&gt;
| Second one is We use Ctrl D to quit Ipython interpreter.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:27&lt;br /&gt;
| The final one is We use ? at the end of the function name to display its documentation.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 11:35&lt;br /&gt;
| So we hope you have enjoyed this tutorial and found it useful. &lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:39&lt;br /&gt;
|Thank you!&lt;br /&gt;
&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Errors-Part-3/English-timed</id>
		<title>PHP-and-MySQL/C2/Common-Errors-Part-3/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Errors-Part-3/English-timed"/>
				<updated>2013-01-02T10:37:32Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00 |Right now I am onto the last two common errors that I have included.  |- |0:05 |And we will start with the hard one.  |- |0:09 |This is php…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|Right now I am onto the last two common errors that I have included. &lt;br /&gt;
|-&lt;br /&gt;
|0:05&lt;br /&gt;
|And we will start with the hard one. &lt;br /&gt;
|-&lt;br /&gt;
|0:09&lt;br /&gt;
|This is php header and we are using &amp;quot;header&amp;quot; function going to a location.&lt;br /&gt;
|-&lt;br /&gt;
|0:14&lt;br /&gt;
|And here I have got some html code. &lt;br /&gt;
|-&lt;br /&gt;
|0:18&lt;br /&gt;
|This is a header tag, I am saying &amp;quot;Welcome!&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|0:21&lt;br /&gt;
|And our &amp;quot;goto&amp;quot; variable is &amp;quot;google dot com&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|0:26&lt;br /&gt;
|If the &amp;quot;goto&amp;quot; exists, which it currently does, we are going to redirect the page to a u-r-l &amp;quot;google dot com&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|0:35&lt;br /&gt;
|Right now, this will return an error.&lt;br /&gt;
|-&lt;br /&gt;
|0:37&lt;br /&gt;
|And the error is - Oh! um... Okay that’s why. &amp;quot;o b start&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|0:50&lt;br /&gt;
|Lets get rid of this.  That wasn’t supposed to be there. That code is to fix the error!&lt;br /&gt;
|-&lt;br /&gt;
|0:56&lt;br /&gt;
|Sorry, so we will go to &amp;quot;php header&amp;quot; and we have got &amp;quot;Welcome!&amp;quot; - our html code.&lt;br /&gt;
|-&lt;br /&gt;
|1:03&lt;br /&gt;
|Then a warning - &amp;quot;Cannot modify  header information – headers already sent by...&amp;quot; and all of this.&lt;br /&gt;
|-&lt;br /&gt;
|1:10&lt;br /&gt;
|Okay so our headers have already been sent. This is the line no. by the way.&lt;br /&gt;
|-&lt;br /&gt;
|1:16&lt;br /&gt;
|1, 2, 3 so if it gives you an error like &amp;quot;phpheader dot php&amp;quot; colon 3, then the error has occurred on the line no. 3.&lt;br /&gt;
|-&lt;br /&gt;
|1:26&lt;br /&gt;
|So that's where the error is - on line 3, okay? &lt;br /&gt;
|-&lt;br /&gt;
|1:32&lt;br /&gt;
|And this error has been generated by line 9, which if you go here, is our &amp;quot;header&amp;quot; function. &lt;br /&gt;
|-&lt;br /&gt;
|1:39&lt;br /&gt;
|So the reason that this is happening is we are already sending our html code.&lt;br /&gt;
|-&lt;br /&gt;
|1:47&lt;br /&gt;
|If I get rid of this by commenting it, and I were to refresh then we would be redirected to google.&lt;br /&gt;
|-&lt;br /&gt;
|1:54&lt;br /&gt;
|But the point is that we want this welcome header here.&lt;br /&gt;
|-&lt;br /&gt;
|1:59&lt;br /&gt;
|And you can’t actually put html before a header function, going to location and other features of this function. &lt;br /&gt;
|-&lt;br /&gt;
|2:10&lt;br /&gt;
|You shouldn't do so.&lt;br /&gt;
|-&lt;br /&gt;
|2:15&lt;br /&gt;
|So as you saw a minute ago that is &amp;quot;ob underscore start&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|2:20&lt;br /&gt;
|What this does is, it fixes this problem for us.&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
|So I can come here to &amp;quot;phpheader&amp;quot; and it works, even though I have still got my html code echoed here before my header.&lt;br /&gt;
|-&lt;br /&gt;
|2:37&lt;br /&gt;
|So without this we get an error (pause) and with this our header works fine, okay?  &lt;br /&gt;
|-&lt;br /&gt;
|2:47&lt;br /&gt;
|Despite the initial rule of no html output before header up here.&lt;br /&gt;
|-&lt;br /&gt;
|2:53&lt;br /&gt;
|That should be pretty clear by now.&lt;br /&gt;
|-&lt;br /&gt;
|2:55&lt;br /&gt;
|Now, the last one is extremely simple. &lt;br /&gt;
|-&lt;br /&gt;
|2:58&lt;br /&gt;
|I don’t even need to explain it but anyway.&lt;br /&gt;
|-&lt;br /&gt;
|3:02&lt;br /&gt;
|This is &amp;quot;include a file which doesn’t even exist&amp;quot; named as &amp;quot;idontexist dot php&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:08&lt;br /&gt;
|So lets have a look. Um.. where is it? &amp;quot;missing dot php&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:13&lt;br /&gt;
|Oh no! Its not.  &amp;quot;open dot php&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:16&lt;br /&gt;
|Okay! So - include &amp;quot;idontexist dot php&amp;quot; failed to open stream; no such file or directory in that name here.&lt;br /&gt;
|-&lt;br /&gt;
|3:25&lt;br /&gt;
|Our file name and directory on line 3.&lt;br /&gt;
|-&lt;br /&gt;
|3:27&lt;br /&gt;
|So lets come to line 3.&lt;br /&gt;
|-&lt;br /&gt;
|3:30&lt;br /&gt;
|And that is the only line of significant code in this file.&lt;br /&gt;
|-&lt;br /&gt;
|3:35&lt;br /&gt;
|We have another warning here - Failed to open &amp;quot;idontexist dot php&amp;quot; for inclusion and all of this.  So we get two errors. &lt;br /&gt;
|-&lt;br /&gt;
|3:43&lt;br /&gt;
|This is quite messy when you have a page that has &amp;quot;include a header file&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:50&lt;br /&gt;
|Then these don’t look too nice. I mean you have probably been in a website before and you have seen this at the top. &lt;br /&gt;
|-&lt;br /&gt;
|3:57&lt;br /&gt;
|You need to be attractive.  So you can put a &amp;quot;@ (at)&amp;quot; symbol in front and refresh.&lt;br /&gt;
|-&lt;br /&gt;
|4:02&lt;br /&gt;
|That won't show the error anymore. &lt;br /&gt;
|-&lt;br /&gt;
|4:06&lt;br /&gt;
|But it doesn’t excuse the fact that the file doesn’t exist.&lt;br /&gt;
|-&lt;br /&gt;
|4:10&lt;br /&gt;
|So the content of the file which doesn’t exist, won’t be included. &lt;br /&gt;
|-&lt;br /&gt;
|4:14&lt;br /&gt;
|But yes, to be honest, looking at this, this is really pretty much self explanatory.  I just thought I should explain this anyways.&lt;br /&gt;
|-&lt;br /&gt;
|4:23&lt;br /&gt;
|So we have got a small collection of errors that you might come across when you are programming in php. &lt;br /&gt;
|-&lt;br /&gt;
|4:30&lt;br /&gt;
|If there are other errors that you are getting, then please message me and I will be happy to help. &lt;br /&gt;
|-&lt;br /&gt;
|4:39&lt;br /&gt;
|Please subscribe for latest updates. Thanks for watching. This is Evan Varkey dubbing for the Spoken Tutorial project.&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Errors-Part-2/English-timed</id>
		<title>PHP-and-MySQL/C2/Common-Errors-Part-2/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Errors-Part-2/English-timed"/>
				<updated>2013-01-02T10:36:42Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00 |Hello again. Welcome to the second part of our error tutorial on how to spot errors and how to fix them.  |- |0:08 |I have called this &amp;quot;ext…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|Hello again. Welcome to the second part of our error tutorial on how to spot errors and how to fix them. &lt;br /&gt;
|-&lt;br /&gt;
|0:08&lt;br /&gt;
|I have called this &amp;quot;extrachar dot php&amp;quot; and the reason is that when we run this, ...lets go back, ...click on &amp;quot;extrachar&amp;quot;, we get this error &amp;quot;Parse error in&amp;quot; and all of this and on line 6. &lt;br /&gt;
|-&lt;br /&gt;
|0:23&lt;br /&gt;
|We are given no information what-so-ever as to what we are expecting or what we are not expecting or anything of that sort. &lt;br /&gt;
|-&lt;br /&gt;
|0:32&lt;br /&gt;
|We jump to line 6 which is here and at first glance this might look okay. &lt;br /&gt;
|-&lt;br /&gt;
|0:37&lt;br /&gt;
|But we have actually got an extra bracket on here so we are deleting that and you can see this now works. &lt;br /&gt;
|-&lt;br /&gt;
|0:44&lt;br /&gt;
|And now that's pretty easy to spot.&lt;br /&gt;
|-&lt;br /&gt;
|0:47&lt;br /&gt;
|However when you are doing things like mathematical calculations for example like adding, comparing, etc..  if you are doing mathematical calculations like this and you lose track of your brackets. &lt;br /&gt;
|-&lt;br /&gt;
|1:09&lt;br /&gt;
|Sometimes it is very easy to solve. When we run this, nothing is going to come up because these two don’t equal each other.&lt;br /&gt;
|-&lt;br /&gt;
|1:18&lt;br /&gt;
|That didn't return any errors. &lt;br /&gt;
|-&lt;br /&gt;
|1:20&lt;br /&gt;
|But if I add an extra bracket here, we'll get a &amp;quot;Parse error&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|1:28&lt;br /&gt;
|When you solve complicated if statements or complex mathematical operations, you should check that the brackets match.&lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|Just make sure that you are checking for all the brackets or anything else like some characters that seem to be in there. &lt;br /&gt;
|-&lt;br /&gt;
|1:48&lt;br /&gt;
|For example - lets put an &amp;quot;a&amp;quot; in front of that. &lt;br /&gt;
|-&lt;br /&gt;
|1:52&lt;br /&gt;
|See - when we go back we still get a &amp;quot;Parse error&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|1:56&lt;br /&gt;
|Lets get rid of this.  Refresh that, still getting a &amp;quot;Parse error&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|2:00&lt;br /&gt;
|So you know you might have typed something.  Lets remove that.&lt;br /&gt;
|-&lt;br /&gt;
|2:04&lt;br /&gt;
|Okay now the next one I will show is the &amp;quot;missing page&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|2:08&lt;br /&gt;
|Let me show you the error for this. Click on &amp;quot;missing.php&amp;quot;.  Ok we get more Parse errors as seen on line 9. &lt;br /&gt;
|-&lt;br /&gt;
|2:17&lt;br /&gt;
|Lets go down and where is line 9?  Semicolon.  &lt;br /&gt;
|-&lt;br /&gt;
|2:23&lt;br /&gt;
|Okay sorry that was actually not intended.  So lets refresh again.&lt;br /&gt;
|-&lt;br /&gt;
|2:28&lt;br /&gt;
|Okay.  So we have got a &amp;quot;Parse error&amp;quot; on line 18. &lt;br /&gt;
|-&lt;br /&gt;
|2:33&lt;br /&gt;
|Lets go to line 18. &lt;br /&gt;
|-&lt;br /&gt;
|2:37&lt;br /&gt;
|Okay now - line 18 - this line here where I am pointing is line 18.&lt;br /&gt;
|-&lt;br /&gt;
|2:47&lt;br /&gt;
|So what is wrong with line 18?&lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|There is absolutely no content on line 18. How could we possibly have an error? &lt;br /&gt;
|-&lt;br /&gt;
|2:54&lt;br /&gt;
|And the reason for that is what I said earlier - to check around this area.&lt;br /&gt;
|-&lt;br /&gt;
|3:00&lt;br /&gt;
|So we have to check a couple of lines up - say 4 or 5 lines up. &lt;br /&gt;
|-&lt;br /&gt;
|3:06&lt;br /&gt;
|What we have is an &amp;quot;if&amp;quot; statement - &amp;quot;if posted user name equals 'Alex'&amp;quot;, echo &amp;quot;You own PHP Academy&amp;quot;, else echo &amp;quot;Hello name&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:17&lt;br /&gt;
|We might say that we have got a starting curly bracket and an ending curly bracket for this &amp;quot;if&amp;quot; statement here. &lt;br /&gt;
|-&lt;br /&gt;
|3:24&lt;br /&gt;
|Why isn’t it working? That's because we have already started an &amp;quot;if&amp;quot; statement up here. &lt;br /&gt;
|-&lt;br /&gt;
|3:30&lt;br /&gt;
|And this is the purpose of indentation and the usefulness of indentation. &lt;br /&gt;
|-&lt;br /&gt;
|3:36&lt;br /&gt;
|To me when I look at this from experience, I know that since this bracket is indented , that bracket should be indented here, in the same line.&lt;br /&gt;
|-&lt;br /&gt;
|3:45&lt;br /&gt;
|Therefore it is missing. So if this was there and that was indented here, then I would know that's from the previous &amp;quot;if&amp;quot; statement up here where the block starts here and the block ends here. &lt;br /&gt;
|-&lt;br /&gt;
|3:59&lt;br /&gt;
|But here, the block starts here and there is no end bracket here. &lt;br /&gt;
|-&lt;br /&gt;
|4:03&lt;br /&gt;
|I'll put it here.  And when we run this, there you go! It starts working now. &lt;br /&gt;
|-&lt;br /&gt;
|4:08&lt;br /&gt;
|So if you miss out characters, you will find that you get weird places for the errors.&lt;br /&gt;
|-&lt;br /&gt;
|4:14&lt;br /&gt;
|In fact, this is not a weird place for the error because we are saying &amp;quot;else&amp;quot;, start of block and end of block.&lt;br /&gt;
|-&lt;br /&gt;
|4:20&lt;br /&gt;
|And what we are looking for is an end to this block now because this is the block that hasn’t been ended. &lt;br /&gt;
|-&lt;br /&gt;
|4:28&lt;br /&gt;
|So we are saying the line error is not actually here because we require an end to a block here.&lt;br /&gt;
|-&lt;br /&gt;
|4:35&lt;br /&gt;
|Now that will work, okay? &lt;br /&gt;
|-&lt;br /&gt;
|4:38&lt;br /&gt;
|So just look around couple of lines up and see where you might have an else without an end or some other character missing or something else that you require that's missing. &lt;br /&gt;
|-&lt;br /&gt;
|4:49&lt;br /&gt;
|Next lets switch to the &amp;quot;getpost dot php&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|4:53&lt;br /&gt;
|I have used the error-reporting &amp;quot;E All&amp;quot; just to demonstrate this. &lt;br /&gt;
|-&lt;br /&gt;
|4:58&lt;br /&gt;
|This is to &amp;quot;demonstrate&amp;quot;. This type of error is going to be reported. &lt;br /&gt;
|-&lt;br /&gt;
|5:03&lt;br /&gt;
|This doesn't mean all errors. Its not an exhaustive list of all the errors that can be reported. &lt;br /&gt;
|-&lt;br /&gt;
|5:10&lt;br /&gt;
|This is just a parameter for this function. &lt;br /&gt;
|-&lt;br /&gt;
|5:12&lt;br /&gt;
|This will allow us to see some errors that the user wouldn’t usually say.  I mean you wouldn’t use this if you were to launch your own website. But I have a tutorial on this which you should see.  &lt;br /&gt;
|-&lt;br /&gt;
|5:25&lt;br /&gt;
|So, this is a &amp;quot;get post&amp;quot; error. &lt;br /&gt;
|-&lt;br /&gt;
|5:28&lt;br /&gt;
|Lets go here. Ok, so we have got a variable called &amp;quot;data&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|This is the GET variable called &amp;quot;name&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|5:38&lt;br /&gt;
|Our code says &amp;quot;if this data variable exists, echo data&amp;quot; and this seems like a pretty normal program.&lt;br /&gt;
|-&lt;br /&gt;
|5:47&lt;br /&gt;
|There is no actual error here. &lt;br /&gt;
|-&lt;br /&gt;
|5:49&lt;br /&gt;
|We are taking some variable here and everything is working and there is no line break error or line terminating error, either. &lt;br /&gt;
|-&lt;br /&gt;
|6:07&lt;br /&gt;
|We have not missed anything, we don’t need to put anything in. &lt;br /&gt;
|-&lt;br /&gt;
|6:15&lt;br /&gt;
|But when I run this page, we get a notice. &lt;br /&gt;
|-&lt;br /&gt;
|6:18&lt;br /&gt;
|Now this is not a &amp;quot;Parse error&amp;quot; which you have seen before.  This is a notice. &lt;br /&gt;
|-&lt;br /&gt;
|6:27&lt;br /&gt;
|And the page can’t function properly with this error present. &lt;br /&gt;
|-&lt;br /&gt;
|6:33&lt;br /&gt;
|Let me show you - here I say &amp;quot;name equals alex&amp;quot; and this error disappears.&lt;br /&gt;
|-&lt;br /&gt;
|6:41&lt;br /&gt;
|This shows that there is nothing really wrong with our code but what was wrong in first place, was that this data variable had not been fulfilled. &lt;br /&gt;
|-&lt;br /&gt;
|6:51&lt;br /&gt;
|It's the same as saying &amp;quot;data equals absolutely nothing&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|6:58&lt;br /&gt;
|Here let me say &amp;quot;echo variable alex&amp;quot; and this is line 5. &lt;br /&gt;
|-&lt;br /&gt;
|7:05&lt;br /&gt;
|Lets refresh. Undefined variable alex, Undefined index name. &lt;br /&gt;
|-&lt;br /&gt;
|7:11&lt;br /&gt;
|So what we are doing is - okay, let me start from the beginning.&lt;br /&gt;
|-&lt;br /&gt;
|7:19&lt;br /&gt;
|This is unfulfilled if the name has not been specified in the header.&lt;br /&gt;
|-&lt;br /&gt;
|7:23&lt;br /&gt;
|Therefore &amp;quot;data equals nothing&amp;quot; and so we get the error &amp;quot;Undefined index&amp;quot;, just like we get &amp;quot;Undefined variable&amp;quot; if we echo a variable that hasn't been set. &lt;br /&gt;
|-&lt;br /&gt;
|7:35&lt;br /&gt;
|So as soon as we put some data in here, this error goes. &lt;br /&gt;
|-&lt;br /&gt;
|7:39&lt;br /&gt;
|Lets refresh . &lt;br /&gt;
|-&lt;br /&gt;
|7:41&lt;br /&gt;
|If you want to get rid of this initial error all you need to do is put a &amp;quot;@ (at)&amp;quot; symbol in between or at the start of this line.&lt;br /&gt;
|-&lt;br /&gt;
|7:50&lt;br /&gt;
|When we refresh, we get nothing because no error has been set. &lt;br /&gt;
|-&lt;br /&gt;
|7:55&lt;br /&gt;
|No get variable has been set. And as soon as we say &amp;quot;name equals alex&amp;quot; our name is echoed out just like the code here specifies. &lt;br /&gt;
|-&lt;br /&gt;
|8:04&lt;br /&gt;
|So even though you are using this &amp;quot;if data exists&amp;quot;, technically this still doesn’t exist, if nothing has been put here. So look out for them. &lt;br /&gt;
|-&lt;br /&gt;
|8:14&lt;br /&gt;
|That's all for now. In the last part, I will go through the next two common errors quickly.  See you there.&lt;br /&gt;
|-&lt;br /&gt;
|8:20&lt;br /&gt;
|This is Evan Varkey dubbing for the Spoken Tutorial project.&lt;br /&gt;
Thanks for watching .&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Errors-Part-1/English-timed</id>
		<title>PHP-and-MySQL/C2/Common-Errors-Part-1/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Errors-Part-1/English-timed"/>
				<updated>2013-01-02T10:35:45Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00 |Hello and welcome.  This is more of an explanation to video. |- |0:07 |I will go through some of the common errors you might encounter when…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|Hello and welcome.  This is more of an explanation to video.&lt;br /&gt;
|-&lt;br /&gt;
|0:07&lt;br /&gt;
|I will go through some of the common errors you might encounter when you are programming in PHP.&lt;br /&gt;
|-&lt;br /&gt;
|0:13&lt;br /&gt;
|Most of them are self explanatory. &lt;br /&gt;
|-&lt;br /&gt;
|0:17&lt;br /&gt;
|I would say a good 50% of errors that you encounter are when you either don't see something you have accidentally typed or you have missed out something. &lt;br /&gt;
|-&lt;br /&gt;
|0:32&lt;br /&gt;
|Everyone makes such mistakes - missing either a semicolon or adding an extra bracket or something like that.&lt;br /&gt;
|-&lt;br /&gt;
|0:41&lt;br /&gt;
|Now I have created a few pages here. These are some of the errors you are likely to encounter.&lt;br /&gt;
|-&lt;br /&gt;
|0:47&lt;br /&gt;
|There are more. This list isn’t exhaustive.  This will just cover some of the basics. &lt;br /&gt;
|-&lt;br /&gt;
|0:51&lt;br /&gt;
|I have got a context editor ready to take you through each error one by one.&lt;br /&gt;
|-&lt;br /&gt;
|1:00&lt;br /&gt;
|So the first one I am going to explain is this &amp;quot;html&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|1:06&lt;br /&gt;
|I used a lot of html embedded in our &amp;quot;echo&amp;quot; command here.&lt;br /&gt;
|-&lt;br /&gt;
|1:10&lt;br /&gt;
|If I try to run this page here, we get this error here. &lt;br /&gt;
|-&lt;br /&gt;
|1:17&lt;br /&gt;
|It says &amp;quot;Parse error&amp;quot; and we get this message here.&lt;br /&gt;
|-&lt;br /&gt;
|1:21&lt;br /&gt;
|You really need to look for these - expecting either a comma or a semicolon. &lt;br /&gt;
|-&lt;br /&gt;
|1:27&lt;br /&gt;
|It gives us a line number. So this will always return a line no. when we get one of these parse errors.&lt;br /&gt;
|-&lt;br /&gt;
|1:34&lt;br /&gt;
|It says here line 5. &lt;br /&gt;
|-&lt;br /&gt;
|1:36&lt;br /&gt;
|So if we come down to line 5; you can see here that is line 5 column 19 (Ln5, Col19); we get all the information. &lt;br /&gt;
|-&lt;br /&gt;
|1:45&lt;br /&gt;
|Line 5 is here.&lt;br /&gt;
|-&lt;br /&gt;
|1:46&lt;br /&gt;
|Now there isn’t anything visually wrong with this.&lt;br /&gt;
|-&lt;br /&gt;
|1:50&lt;br /&gt;
|The way php interprets a command like &amp;quot;echo&amp;quot; is that we get the starting point, our double quotes here and our ending point here. So this will be the start and this will be our end.&lt;br /&gt;
|-&lt;br /&gt;
|2:06&lt;br /&gt;
|Now what’s really happening here is that because we are embedding the html, we are using double quotes in between and this means that the echo command would be read as starting here and ending here.&lt;br /&gt;
|-&lt;br /&gt;
|2:17&lt;br /&gt;
|I think I have explained this in my echo function tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|2:21&lt;br /&gt;
|Okay so the reason that we are getting an error in this line is because this is the first occurrence of a double quotes where it shouldn’t be.&lt;br /&gt;
|-&lt;br /&gt;
|2:31&lt;br /&gt;
|Now technically, php hasn’t picked this up, so this shouldn’t be here.&lt;br /&gt;
|-&lt;br /&gt;
|2:36&lt;br /&gt;
|But what it was saying about expecting a semicolon was that when we end an echo, we use a semicolon. So what it was looking for is that there.&lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|But then even after this, it becomes absolute rubbish. &lt;br /&gt;
|-&lt;br /&gt;
|2:52&lt;br /&gt;
|So what we need to do is use our single quotation marks instead.&lt;br /&gt;
|-&lt;br /&gt;
|2:58&lt;br /&gt;
|Now if I were to save that, we will now get an error on line 6 because the error has come down to it, that changes to 6.&lt;br /&gt;
|-&lt;br /&gt;
|3:08&lt;br /&gt;
|See you know you need to change something on line 6 or nearer line 6. You’ll see some of the other ones we will be doing, some don’t return the actual line error.&lt;br /&gt;
|-&lt;br /&gt;
|3:19&lt;br /&gt;
|And there you go. So you have got that after running our html code. There’s obviously no functionality. But we have covered that.&lt;br /&gt;
|-&lt;br /&gt;
|3:28&lt;br /&gt;
|Okay so the next one I'm going to do is the semicolon. This is one other common error.&lt;br /&gt;
|-&lt;br /&gt;
|3:33&lt;br /&gt;
|We go back here and click on semicolon. We have got a parse error here &amp;quot;expecting a semicolon&amp;quot;.&lt;br /&gt;
|-&lt;br /&gt;
|3:39&lt;br /&gt;
|Now why are we expecting a semicolon? This code looks okay. We have got a variable here with &amp;quot;Alex&amp;quot;.  We have another variable here with &amp;quot;Alex&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|3:47&lt;br /&gt;
|We are comparing these variables. We need double equals in there. &lt;br /&gt;
|-&lt;br /&gt;
|3:52&lt;br /&gt;
|If this condition is true, we will echo this message.&lt;br /&gt;
|-&lt;br /&gt;
|3:55&lt;br /&gt;
|Now if we go here - line no. 9. &lt;br /&gt;
|-&lt;br /&gt;
|3:58&lt;br /&gt;
|So obviously, this is a very simple code. If it were a bit more complex, you came to line 9, but this is in fact line 9.&lt;br /&gt;
|-&lt;br /&gt;
|4:07&lt;br /&gt;
|Now looking at that, there is nothing wrong with line 9. &lt;br /&gt;
|-&lt;br /&gt;
|4:10&lt;br /&gt;
|But in a way, there is something wrong with that line. What we have is the way php interprets the pages; it’s on a single line basis. &lt;br /&gt;
|-&lt;br /&gt;
|4:19&lt;br /&gt;
|So the code we see here is the same as that.&lt;br /&gt;
|-&lt;br /&gt;
|4:23&lt;br /&gt;
|That would actually compile and work but because this is down here; and this is the same as up here; we are still expecting a semicolon after that.&lt;br /&gt;
|-&lt;br /&gt;
|4:34&lt;br /&gt;
|If we do this, this is still a valid code. So I have added a semicolon there, although to the human eye visually it should be there. &lt;br /&gt;
|-&lt;br /&gt;
|4:42&lt;br /&gt;
|We can bring it down here. So let me just re-run this code. &lt;br /&gt;
|-&lt;br /&gt;
|4:53&lt;br /&gt;
|There you go. So we get a successful page.&lt;br /&gt;
|-&lt;br /&gt;
|4:57&lt;br /&gt;
|Obviously if I were to put that up here, that would also be a valid code, as would that. &lt;br /&gt;
|-&lt;br /&gt;
|5:02&lt;br /&gt;
|So php doesn’t work on the basis that &amp;quot;there’s an error on this line&amp;quot;. &lt;br /&gt;
|-&lt;br /&gt;
|5:07&lt;br /&gt;
|It usually says the current line can’t be run may be because of an error on previous line.&lt;br /&gt;
|-&lt;br /&gt;
|5:13&lt;br /&gt;
|So because of this error on this line without the semicolon, this line cannot run. Therefore, the line has been returned as an error on line 9. You can see that there.&lt;br /&gt;
|-&lt;br /&gt;
|5:29&lt;br /&gt;
|So that’s two basic errors that we have covered. &lt;br /&gt;
|-&lt;br /&gt;
|5:33&lt;br /&gt;
|If you ever get things like that, just check and don’t necessarily check the line that the error has been returned on.&lt;br /&gt;
|-&lt;br /&gt;
|5:40&lt;br /&gt;
|Check before, check after. No, not after but check before and see if you can fix anything. &lt;br /&gt;
|-&lt;br /&gt;
|5:47&lt;br /&gt;
|Just scan through every single character if you have to.&lt;br /&gt;
|-&lt;br /&gt;
|5:50&lt;br /&gt;
|I get a lot of emails from people who have made mistakes like that and I don’t mind helping people. &lt;br /&gt;
|-&lt;br /&gt;
|5:56&lt;br /&gt;
|Feel free to ask, but make sure you check your work once, twice or even thrice before you send me anything.&lt;br /&gt;
|-&lt;br /&gt;
|6:04&lt;br /&gt;
|Okay. So in the next parts, we will cover the rest of the error pages. See you soon.  This is Evan Varkey dubbing for the Spoken Tutorial project. (Script contributed by Antara Atrey)&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Way-to-Display-HTML/English-timed</id>
		<title>PHP-and-MySQL/C2/Common-Way-to-Display-HTML/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Common-Way-to-Display-HTML/English-timed"/>
				<updated>2013-01-02T10:34:37Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00-0:21 |Here is a tip for displaying HTML inside your php . This is specially useful when you are using ‘if’ statements or anything that u…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00-0:21&lt;br /&gt;
|Here is a tip for displaying HTML inside your php . This is specially useful when you are using ‘if’ statements or anything that uses a block and when you need to do this on a condition or you need to output a lot of HTML inside something that is working on php.&lt;br /&gt;
|-&lt;br /&gt;
|0:23-0:29&lt;br /&gt;
|In this example, I’ve got a variable- Name, and this is set  to Alex.&lt;br /&gt;
|-&lt;br /&gt;
|0:30-0:35&lt;br /&gt;
|so if i type-  name equals Alex, then, it will echo out “Hi, Alex”&lt;br /&gt;
|-&lt;br /&gt;
|0:36-0:46&lt;br /&gt;
|If name is not equal to Alex-so we type ‘else’- we will echo out “You are not Alex.  Please type your name”.&lt;br /&gt;
|-&lt;br /&gt;
|0:47-0:52&lt;br /&gt;
|And we have an input field here which should have a form around it.  &lt;br /&gt;
|-&lt;br /&gt;
|0:53-1:01&lt;br /&gt;
|So,  “Form action equals Index.php”&lt;br /&gt;
Method =post   &lt;br /&gt;
And we end the form  here.&lt;br /&gt;
|-&lt;br /&gt;
|1:05-1:14&lt;br /&gt;
|We can bring this down a bit, so that it looks better. So, we have  some HTML codes inside this Else block .  &lt;br /&gt;
|-&lt;br /&gt;
|1:15-1:26&lt;br /&gt;
|So we type ‘If else’ and we have got a block starting here,  and a block ending here.  And what could be a lot of HTML code.&lt;br /&gt;
|-&lt;br /&gt;
|1:27-1:33&lt;br /&gt;
|The purpose of this tutorial is to show you that you don’t need to use Echo and echo out HTML code.  &lt;br /&gt;
|-&lt;br /&gt;
|1:34-1:40&lt;br /&gt;
|It’s easier and saves time when you want to code using quotation marks rather than single inverted commas..&lt;br /&gt;
|-&lt;br /&gt;
|1:41-1:51&lt;br /&gt;
|Also it’s nicer to have a code inside the blocks ,say, this block here without having to worry about what you are typing. &lt;br /&gt;
|-&lt;br /&gt;
|1:58-2:08&lt;br /&gt;
|So, if you are used to quotation marks this forward slash will  escape the character.  &lt;br /&gt;
|-&lt;br /&gt;
|2:08-2:18  &lt;br /&gt;
|So, it will be displayed but  will be ignored  as the end of the Echo and the beginning of this Echo here.&lt;br /&gt;
|-&lt;br /&gt;
|2:20-2:24&lt;br /&gt;
|For example.  Let’s just refresh.&lt;br /&gt;
|-&lt;br /&gt;
|2:25-2:30&lt;br /&gt;
|Since name equals Alex it is greeting me as we saw earlier.&lt;br /&gt;
|-&lt;br /&gt;
|2:31-2:41&lt;br /&gt;
|The Echo is okay for a small amount of text but for a large amount with a form etc,  we don’t want  the echo.&lt;br /&gt;
|-&lt;br /&gt;
|2:44-2:55&lt;br /&gt;
|As it stands at present , it won't run. We will receive an error . We haven't provided a method of output for this text.&lt;br /&gt;
|-&lt;br /&gt;
|2:59-3:08&lt;br /&gt;
|That’s on line 12. So, if you go to line 12, you will see that it's here.  We can rectify the problem in this way.&lt;br /&gt;
|-&lt;br /&gt;
|3:09-3:15&lt;br /&gt;
|We have our  php opening tag here. And I am going to end the tag down here .&lt;br /&gt;
|-&lt;br /&gt;
|3:16-3:29&lt;br /&gt;
|So, we are ending the tag after the block starts. Now I will start a new tag just before the flower brackets or curly bracket here.&lt;br /&gt;
|-&lt;br /&gt;
|3:31-3:45&lt;br /&gt;
|So now we have a chunk of php code here and a chunk here.  And the rest here is not interpreted as php.  Since it is HTML it will be displaced as HTML code.&lt;br /&gt;
|-&lt;br /&gt;
|3:49-4:01&lt;br /&gt;
|So, what I am going to do first is change all these to quotation marks.  &lt;br /&gt;
|-&lt;br /&gt;
|3:56-4:06&lt;br /&gt;
|If you implement this method from the beginning ,  you could code easily and it would work a lot better.&lt;br /&gt;
|-&lt;br /&gt;
|4:08-4:20&lt;br /&gt;
|So once again as is visible on the screen we have a block here and the block here.  It may appear as though the  php would end here .&lt;br /&gt;
|-&lt;br /&gt;
|4:22-4:36&lt;br /&gt;
|But we have not ended a block inside here, in this area , but we are going down here.  We aren’t echoing out but displaying this.  &lt;br /&gt;
|-&lt;br /&gt;
|4:37-4:47&lt;br /&gt;
|This applies specifically to the Else block. We end the block in the blue highlighted line here and here .&lt;br /&gt;
|-&lt;br /&gt;
|4:47-4:58&lt;br /&gt;
|So again we will first get “Hi, Alex”. Now if we change the name to Let’s say Kyle, refresh.&lt;br /&gt;
|-&lt;br /&gt;
|5:01-5:07&lt;br /&gt;
|You will see that the HTML has been displayed properly.  But it hasn’t been echoed out using php.&lt;br /&gt;
|-&lt;br /&gt;
|5:09 onwards.&lt;br /&gt;
|This is a good method to use when you want to display HTML properly and re- read easily.  Hope this tutorial has been helpful .Thank you for watching.&lt;br /&gt;
|-&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Embedding-PHP/English-timed</id>
		<title>PHP-and-MySQL/C2/Embedding-PHP/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/Embedding-PHP/English-timed"/>
				<updated>2013-01-02T10:33:52Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00 |This is a short tutorial on how to embed Php code inside HTML code.  This is very useful in many situations. |- |0:14 |For example if I wer…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|This is a short tutorial on how to embed Php code inside HTML code.  This is very useful in many situations.&lt;br /&gt;
|-&lt;br /&gt;
|0:14&lt;br /&gt;
|For example if I were to create Php tags and echo out my name here.&lt;br /&gt;
|-&lt;br /&gt;
|0:23&lt;br /&gt;
|By running this , let's click on a file, we just get an Alex.&lt;br /&gt;
|-&lt;br /&gt;
|0:30&lt;br /&gt;
|Now for example, I can embed HTML inside this and echo it out here to make Alex a little bolder.&lt;br /&gt;
|-&lt;br /&gt;
|0:38&lt;br /&gt;
|But what I can do is I can switch this the other way round.&lt;br /&gt;
|-&lt;br /&gt;
|0:45&lt;br /&gt;
|Let's start again, create an HTML page. I'm going to use this example&lt;br /&gt;
|-&lt;br /&gt;
|0:52&lt;br /&gt;
|I will start a Php and a tag here. I echo out Alex and then come in outside the Php tags and add my bold here and my bold end after the ending Php tag&lt;br /&gt;
|-&lt;br /&gt;
|01:13&lt;br /&gt;
|And it gives us the same result, nothing has changed even though I've refreshed the page&lt;br /&gt;
|-&lt;br /&gt;
|01:20&lt;br /&gt;
|So, we can change that to underline and you can see that Alex is underlined.&lt;br /&gt;
|-&lt;br /&gt;
|01:26&lt;br /&gt;
|So, we can do it either ways.  It's up to you to use the HTML code inside the echo or not.  But there are more uses to this.&lt;br /&gt;
|-&lt;br /&gt;
|01:39&lt;br /&gt;
|Now, if you do know HTML, you know the input tag is a template tag.&lt;br /&gt;
|-&lt;br /&gt;
|01:48&lt;br /&gt;
|So, let's say text and the name of this will be name and the value is going to be equal to Alex&lt;br /&gt;
|-&lt;br /&gt;
|01:56&lt;br /&gt;
|Lets refresh this and we see we've got a text box here with Alex inside.Now I want to use Php to grab the get variable header and put it inside this value of our input value.&lt;br /&gt;
|-&lt;br /&gt;
|02:14&lt;br /&gt;
|Now, this is really useful in some cases like form submission and error checking where you want the posted variables to stay inside the value of each text box.&lt;br /&gt;
|-&lt;br /&gt;
|02:30&lt;br /&gt;
|If you haven't seen the get tutorial already make sure you watch that.&lt;br /&gt;
|-&lt;br /&gt;
|02:38&lt;br /&gt;
|Now, bring this down a couple of lines, obviously we still run this code successfully because it works on similar line basis&lt;br /&gt;
|-&lt;br /&gt;
|02:48&lt;br /&gt;
|So, this you see here is exactly the same as that, you just have to force it down a bit and I'm going to create Php text here&lt;br /&gt;
|-&lt;br /&gt;
|02:58&lt;br /&gt;
|This is going to look a funny brown colour because we're working in Php highlighting and it's not really recognizing this type of highlighting&lt;br /&gt;
|-&lt;br /&gt;
|03:08&lt;br /&gt;
|Ok, I'm just going to echo out Alex&lt;br /&gt;
|-&lt;br /&gt;
|03:12&lt;br /&gt;
|Since this works on a single line basis, bring this all up on a single line.  So now I have embed this inside that and your embedding is done.&lt;br /&gt;
|-&lt;br /&gt;
|03:25&lt;br /&gt;
|By refreshing we get the value of Alex. We're echoing out now Php inside a n HTML value&lt;br /&gt;
|-&lt;br /&gt;
|03:35&lt;br /&gt;
|So, we're using Php code inside our value here&lt;br /&gt;
|-&lt;br /&gt;
|03:40&lt;br /&gt;
|I'm going to demonstrate dollar underscore get ,remember using the single quotes&lt;br /&gt;
|-&lt;br /&gt;
|03:50&lt;br /&gt;
|I'm going to say name and then refresh&lt;br /&gt;
|-&lt;br /&gt;
|03:55&lt;br /&gt;
|Nothing's happened so type in name=Alex which gives us Alex inside that&lt;br /&gt;
|-&lt;br /&gt;
|04:04&lt;br /&gt;
|Type in name=Kyle. It gives us Kyle inside that&lt;br /&gt;
|-&lt;br /&gt;
|04:11&lt;br /&gt;
|Basically you can embed any Php code you want inside that&lt;br /&gt;
|-&lt;br /&gt;
|04:16&lt;br /&gt;
|Try saying echo Php info and you'd get a very funny result&lt;br /&gt;
|-&lt;br /&gt;
|04:28&lt;br /&gt;
|This is the HTML code of Php info document&lt;br /&gt;
|-&lt;br /&gt;
|04:33&lt;br /&gt;
|So, you can see that there's loads of code in that&lt;br /&gt;
|-&lt;br /&gt;
|04:37&lt;br /&gt;
| Here we're just working with Php inside.The only thing you need to worry about is being careful with your single and double quotes&lt;br /&gt;
|-&lt;br /&gt;
|04:46&lt;br /&gt;
|So this was the basic tutorial on embedding Php code inside HTML code&lt;br /&gt;
|-&lt;br /&gt;
|04:53&lt;br /&gt;
|I hope it was useful.Thanks for watching&lt;br /&gt;
|-&lt;br /&gt;
|04:56&lt;br /&gt;
|This is Anoushka dubbing for the Spoken tutorials Project&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/POST-Variable/English-timed</id>
		<title>PHP-and-MySQL/C2/POST-Variable/English-timed</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php/PHP-and-MySQL/C2/POST-Variable/English-timed"/>
				<updated>2013-01-02T10:32:59Z</updated>
		
		<summary type="html">&lt;p&gt;Minal: Created page with '{| border=1 !Time !Narration |- |0:00 |Welcome to the Spoken Tutorial on Post variable. Here I am going to use the same code as that of the 'get.php' page. The same one that I ha…'&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{| border=1&lt;br /&gt;
!Time&lt;br /&gt;
!Narration&lt;br /&gt;
|-&lt;br /&gt;
|0:00&lt;br /&gt;
|Welcome to the Spoken Tutorial on Post variable. Here I am going to use the same code as that of the 'get.php' page. The same one that I have done in my 'get' variable tutorial.&lt;br /&gt;
|-&lt;br /&gt;
|0:13&lt;br /&gt;
|If you have not seen that already, please do so and then go through this tutorial. You will be able to know  all these codes about.&lt;br /&gt;
|-&lt;br /&gt;
|0:21&lt;br /&gt;
|If you already know these codes about and you have not seen the 'get' tutorial, you are welcome to join us.&lt;br /&gt;
|-&lt;br /&gt;
|0:28&lt;br /&gt;
|I have got my page with my 'get' as previous &lt;br /&gt;
|-&lt;br /&gt;
|0:31&lt;br /&gt;
|I have got a new file called 'post.php'&lt;br /&gt;
|-&lt;br /&gt;
|0:36&lt;br /&gt;
|Actually, what I want to do is change this as post and post it as a post variable.&lt;br /&gt;
|-&lt;br /&gt;
|0:44&lt;br /&gt;
|So quite simply and logically I will just go through this and change this to post&lt;br /&gt;
|-&lt;br /&gt;
|0:51&lt;br /&gt;
|and here is what we call 'post' instead of 'get' and this will work&lt;br /&gt;
|-&lt;br /&gt;
|0:57&lt;br /&gt;
|Let me show you my post page&lt;br /&gt;
|-&lt;br /&gt;
|01:00&lt;br /&gt;
|there is nothing here. There is no question mark&lt;br /&gt;
|-&lt;br /&gt;
|01:04&lt;br /&gt;
|Let me type alex and click here. But nothing has come up&lt;br /&gt;
|-&lt;br /&gt;
|01:09&lt;br /&gt;
|that is why&lt;br /&gt;
|-&lt;br /&gt;
|1:11&lt;br /&gt;
|do you remember if you are working with another file, you need to change the action&lt;br /&gt;
|-&lt;br /&gt;
|1:19&lt;br /&gt;
|let's refresh it&lt;br /&gt;
|-&lt;br /&gt;
|1:22&lt;br /&gt;
|I can see alex. Let me click here and this is hello alex&lt;br /&gt;
|-&lt;br /&gt;
|1:28&lt;br /&gt;
|next we are in the 'post.php' font and there is no question mark&lt;br /&gt;
|-&lt;br /&gt;
|1:33&lt;br /&gt;
|something has been taken across. It has been stored inside a post variable&lt;br /&gt;
|-&lt;br /&gt;
|1:39&lt;br /&gt;
|but why it is not showing two users&lt;br /&gt;
|-&lt;br /&gt;
|1:44&lt;br /&gt;
|this will be absolutely brilliant if we can say 'password' .Let's call this 'password'&lt;br /&gt;
|-&lt;br /&gt;
|2:02&lt;br /&gt;
|I'll say here 'thanks for your password' and let's go back&lt;br /&gt;
|-&lt;br /&gt;
|2:11&lt;br /&gt;
|and now, as you can see, this is a password field&lt;br /&gt;
|-&lt;br /&gt;
|2:15&lt;br /&gt;
|so I'll type 123 as my password and I click here&lt;br /&gt;
|-&lt;br /&gt;
|2:22&lt;br /&gt;
|it says, thanks for your password&lt;br /&gt;
|-&lt;br /&gt;
|2:25&lt;br /&gt;
|it has been stored. so it can be used. I can use it, if i want to&lt;br /&gt;
|-&lt;br /&gt;
|2:31&lt;br /&gt;
|I'll just change that. so it makes more sense&lt;br /&gt;
|-&lt;br /&gt;
|2:37&lt;br /&gt;
|let's do a refresh and resend the data&lt;br /&gt;
|-&lt;br /&gt;
|2:42&lt;br /&gt;
|123, click here and its not displaying. That's why&lt;br /&gt;
|-&lt;br /&gt;
|2:49&lt;br /&gt;
|you should check these things. It is easy to make mistakes&lt;br /&gt;
|-&lt;br /&gt;
|2:54&lt;br /&gt;
|Let me type 123. Let me click here and it says 'thanks for your password'. and it as given me my password&lt;br /&gt;
|-&lt;br /&gt;
|3:06&lt;br /&gt;
|It proves that it has been carried across it has been stored in a post variable&lt;br /&gt;
|-&lt;br /&gt;
|3:12&lt;br /&gt;
|but it hasn't shown the user, which could have made sense&lt;br /&gt;
|-&lt;br /&gt;
|3:16&lt;br /&gt;
|because there would be no point having these as blocks. They are not readable in any way.&lt;br /&gt;
|-&lt;br /&gt;
|3:22&lt;br /&gt;
|and here there would no point having it because people can read your password &lt;br /&gt;
|-&lt;br /&gt;
|3:27&lt;br /&gt;
|So it will be very easy for people to look through your internet history. &lt;br /&gt;
|-&lt;br /&gt;
|3:32&lt;br /&gt;
|and see you have typed your password. But people might get access to your account with that&lt;br /&gt;
|-&lt;br /&gt;
|3:38&lt;br /&gt;
|so you can see this post. These are used for functions, also the amount that can be sent through it&lt;br /&gt;
|-&lt;br /&gt;
|3:45&lt;br /&gt;
|so if for example, my password was really long say over 100 characters it will still be accepted &lt;br /&gt;
|-&lt;br /&gt;
|3:52&lt;br /&gt;
|but in the 'get' variable you have a hundred character limit&lt;br /&gt;
|-&lt;br /&gt;
|3:57&lt;br /&gt;
|so the post thus seem to be useful. But if you are evaluating things, like, trying to sort out some things, you can use the get variable&lt;br /&gt;
|-&lt;br /&gt;
|4:08&lt;br /&gt;
|just to see if your data is being passed through.&lt;br /&gt;
|-&lt;br /&gt;
|4:11&lt;br /&gt;
|so basically that's post variable &lt;br /&gt;
|-&lt;br /&gt;
|4:14&lt;br /&gt;
|you would be using it a lot on projects for form submissions. This brings us to the end of this tutorial&lt;br /&gt;
|-&lt;br /&gt;
|4:22&lt;br /&gt;
|This is Siddarth for the Spoken Tutorial Project. Thanks for watching. &lt;br /&gt;
|-&lt;/div&gt;</summary>
		<author><name>Minal</name></author>	</entry>

	</feed>