93 and use the left arrow key to move the cursor on to the + symbol and |
95 and use the left arrow key to move the cursor on to the + symbol and |
94 then use the delete key to remove it and type 0 and * to change the |
96 then use the delete key to remove it and type 0 and * to change the |
95 expression to the required one. We hit enter to see the output of |
97 expression to the required one. We hit enter to see the output of |
96 ``print``. |
98 ``print``. |
97 |
99 |
|
100 .. #[[Anoop: We could create a slide with heading Tab Completion and |
|
101 give the question as an exercise, basically I feel more slides |
|
102 should be used]] |
|
103 |
98 Now, let's say we want to use the function ``round``. We type ``ro`` |
104 Now, let's say we want to use the function ``round``. We type ``ro`` |
99 at the prompt and hit the tab key. As you can see, the IPython |
105 at the prompt and hit the tab key. As you can see, the IPython |
100 completes the command. This feature is called the tab-completion. |
106 completes the command. This feature is called the tab-completion. |
101 |
107 |
102 Now, we remove all the characters and just type ``r`` and then hit |
108 Now, we remove all the characters and just type ``r`` and then hit |
103 tab. IPython does not complete the command since there are many |
109 tab. IPython does not complete the command since there are many |
104 possibilities. It just lists out all the possible completions. |
110 possibilities. It just lists out all the possible completions. |
105 |
111 |
106 Following is an exercise that you must do. |
112 Following is an exercise that you must do. |
107 |
113 |
|
114 .. #[[Anoop: Include slides for exercises]] |
|
115 |
108 %%1%% Type ``ab`` and hit tab to see what happens. Next, just type |
116 %%1%% Type ``ab`` and hit tab to see what happens. Next, just type |
109 ``a`` and hit tab to see what happens. |
117 ``a`` and hit tab to see what happens. |
110 |
118 |
111 Please, pause the video here. Do the exercise and then continue. |
119 Please, pause the video here. Do the exercise and then continue. |
112 |
120 |
114 the commands starting with a. |
122 the commands starting with a. |
115 |
123 |
116 Now, let's see what these functions are used for. We will use the |
124 Now, let's see what these functions are used for. We will use the |
117 help features of ipython to find this out. |
125 help features of ipython to find this out. |
118 |
126 |
|
127 .. #[[Anoop: Another slide which says about ? mark and round? etc, as |
|
128 few people cannot just follow by listening (like me) :)]] |
|
129 |
119 To get the help of any function, we first type the function, ``abs`` |
130 To get the help of any function, we first type the function, ``abs`` |
120 in our case and then add a ? at the end and hit enter. |
131 in our case and then add a ? at the end and hit enter. |
121 |
132 |
122 As the documentation says, ``abs`` accepts a number as an input and |
133 As the documentation says, ``abs`` accepts a number as an input and |
123 returns it's absolute value. |
134 returns it's absolute value. |
133 |
144 |
134 Does it work for decimals (or floats)? Let's try typing abs(-10.5) |
145 Does it work for decimals (or floats)? Let's try typing abs(-10.5) |
135 and we do get back 10.5. |
146 and we do get back 10.5. |
136 |
147 |
137 Following is an exercise that you must do. |
148 Following is an exercise that you must do. |
|
149 |
|
150 .. #[[Anoop: add slide]] |
138 |
151 |
139 %%2%% Look-up the documentation of ``round`` and see how to use it. |
152 %%2%% Look-up the documentation of ``round`` and see how to use it. |
140 |
153 |
141 Please, pause the video here. Do the exercise and then continue. |
154 Please, pause the video here. Do the exercise and then continue. |
142 |
155 |
184 type Ctrl-C to interrupt the command and get back the ``ipython`` input |
199 type Ctrl-C to interrupt the command and get back the ``ipython`` input |
185 prompt. |
200 prompt. |
186 |
201 |
187 Following is an exercise that you must do. |
202 Following is an exercise that you must do. |
188 |
203 |
|
204 .. #[[Anoop: add slide]] |
|
205 |
189 %%4%% Try typing round(2.484, and hit enter. and then cancel the |
206 %%4%% Try typing round(2.484, and hit enter. and then cancel the |
190 command using Ctrl-C. Then, type the command, round(2.484, 2) and |
207 command using Ctrl-C. Then, type the command, round(2.484, 2) and |
191 resume the video. |
208 resume the video. |
192 |
209 |
193 Please, pause the video here. Do the exercises and then continue. |
210 Please, pause the video here. Do the exercises and then continue. |
199 |
216 |
200 round(2.484, 2) |
217 round(2.484, 2) |
201 |
218 |
202 This brings us to the end of the tutorial on getting started with |
219 This brings us to the end of the tutorial on getting started with |
203 ``ipython``. |
220 ``ipython``. |
|
221 |
|
222 .. #[[Anoop: add slides for interrupts, navigating history, I feel |
|
223 even a single point will also do]] |
204 |
224 |
205 In this tutorial we have learnt, how to |
225 In this tutorial we have learnt, how to |
206 {{{ show the outline/summary slide. }}} |
226 {{{ show the outline/summary slide. }}} |
207 |
227 |
208 1. invoke the ``ipython`` interpreter. |
228 1. invoke the ``ipython`` interpreter. |