<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="https://script.spoken-tutorial.org/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python%2FC2%2FAdditional-features-of-IPython%2FGujarati</id>
		<title>Python/C2/Additional-features-of-IPython/Gujarati - Revision history</title>
		<link rel="self" type="application/atom+xml" href="https://script.spoken-tutorial.org/index.php?action=history&amp;feed=atom&amp;title=Python%2FC2%2FAdditional-features-of-IPython%2FGujarati"/>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python/C2/Additional-features-of-IPython/Gujarati&amp;action=history"/>
		<updated>2026-04-27T15:48:47Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.23.17</generator>

	<entry>
		<id>https://script.spoken-tutorial.org/index.php?title=Python/C2/Additional-features-of-IPython/Gujarati&amp;diff=6813&amp;oldid=prev</id>
		<title>Krupali: Created page with '{| border=1 !Timing !Narration |- | 0:00 | Hello friends and welcome to the tutorial on &quot;Additional Features of IPython&quot;.  |- | 0:06 | At the end of this tutorial, you will be ab…'</title>
		<link rel="alternate" type="text/html" href="https://script.spoken-tutorial.org/index.php?title=Python/C2/Additional-features-of-IPython/Gujarati&amp;diff=6813&amp;oldid=prev"/>
				<updated>2013-10-30T04:59:03Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;#039;{| 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…&amp;#039;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| border=1&lt;br /&gt;
!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 cosx  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 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 other 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 space 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 show then brackets on your terminal&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
| 7:38&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;
|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 name.&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 only,&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 , 14  and 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 get 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 included hypen  included dot py&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|  10:04&lt;br /&gt;
| We see that it raises Name Error 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 percentage hist,percentage hist  minus 5,percentage hist 5,percentage hist 5 to 10&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 percentage save filepath 2 hyphen 5 7 9 hyphen 11,percentage save filepath 2 hyphen 11,percentage save filepath  percentage save 2 hyphen 5 7 9 10 11&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:24&lt;br /&gt;
|And the final question is What will the command percentage hist 5 10 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 percentage hist 5 for the first question.&lt;br /&gt;
&lt;br /&gt;
|-&lt;br /&gt;
|11:49&lt;br /&gt;
|So second question answer is percentage save file path 2 hyphen 5 space  7  space 9 hyphen 11 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 percentage hist 5 space 10 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>Krupali</name></author>	</entry>

	</feed>