72 |
72 |
73 at the prompt. IPython promptly gives back the output as 3. Notice |
73 at the prompt. IPython promptly gives back the output as 3. Notice |
74 that the output is displayed with an ``Out[1]`` indication. |
74 that the output is displayed with an ``Out[1]`` indication. |
75 |
75 |
76 .. #[[Anoop: I think we can illustrate In [] and Out[] in slides]] |
76 .. #[[Anoop: I think we can illustrate In [] and Out[] in slides]] |
|
77 .. #[[Puneeth: I think we can do that on the terminal?]] |
77 |
78 |
78 Let's try out few other mathematical operations. |
79 Let's try out few other mathematical operations. |
79 :: |
80 :: |
80 |
81 |
81 5 - 3 |
82 5 - 3 |
95 and use the left arrow key to move the cursor on to the + symbol and |
96 and use the left arrow key to move the cursor on to the + symbol and |
96 then use the delete key to remove it and type 0 and * to change the |
97 then use the delete key to remove it and type 0 and * to change the |
97 expression to the required one. We hit enter to see the output of |
98 expression to the required one. We hit enter to see the output of |
98 ``print``. |
99 ``print``. |
99 |
100 |
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 |
|
104 Now, let's say we want to use the function ``round``. We type ``ro`` |
101 Now, let's say we want to use the function ``round``. We type ``ro`` |
105 at the prompt and hit the tab key. As you can see, the IPython |
102 at the prompt and hit the tab key. As you can see, the IPython |
106 completes the command. This feature is called the tab-completion. |
103 completes the command. This feature is called the tab-completion. |
107 |
104 |
108 Now, we remove all the characters and just type ``r`` and then hit |
105 Now, we remove all the characters and just type ``r`` and then hit |
109 tab. IPython does not complete the command since there are many |
106 tab. IPython does not complete the command since there are many |
110 possibilities. It just lists out all the possible completions. |
107 possibilities. It just lists out all the possible completions. |
111 |
108 |
112 Following is an exercise that you must do. |
109 Following is an exercise that you must do. |
113 |
110 |
114 .. #[[Anoop: Include slides for exercises]] |
|
115 |
|
116 %%1%% Type ``ab`` and hit tab to see what happens. Next, just type |
111 %%1%% Type ``ab`` and hit tab to see what happens. Next, just type |
117 ``a`` and hit tab to see what happens. |
112 ``a`` and hit tab to see what happens. |
118 |
113 |
119 Please, pause the video here. Do the exercise and then continue. |
114 Please, pause the video here. Do the exercise and then continue. |
120 |
115 |
125 help features of ipython to find this out. |
120 help features of ipython to find this out. |
126 |
121 |
127 .. #[[Anoop: Another slide which says about ? mark and round? etc, as |
122 .. #[[Anoop: Another slide which says about ? mark and round? etc, as |
128 few people cannot just follow by listening (like me) :)]] |
123 few people cannot just follow by listening (like me) :)]] |
129 |
124 |
|
125 .. #[Punch: These things are shown on the terminal. I feel we don't |
|
126 .. need slide, here I guess.] |
|
127 |
130 To get the help of any function, we first type the function, ``abs`` |
128 To get the help of any function, we first type the function, ``abs`` |
131 in our case and then add a ? at the end and hit enter. |
129 in our case and then add a ? at the end and hit enter. |
132 |
130 |
133 As the documentation says, ``abs`` accepts a number as an input and |
131 As the documentation says, ``abs`` accepts a number as an input and |
134 returns it's absolute value. |
132 returns it's absolute value. |
144 |
142 |
145 Does it work for decimals (or floats)? Let's try typing abs(-10.5) |
143 Does it work for decimals (or floats)? Let's try typing abs(-10.5) |
146 and we do get back 10.5. |
144 and we do get back 10.5. |
147 |
145 |
148 Following is an exercise that you must do. |
146 Following is an exercise that you must do. |
149 |
|
150 .. #[[Anoop: add slide]] |
|
151 |
147 |
152 %%2%% Look-up the documentation of ``round`` and see how to use it. |
148 %%2%% Look-up the documentation of ``round`` and see how to use it. |
153 |
149 |
154 Please, pause the video here. Do the exercise and then continue. |
150 Please, pause the video here. Do the exercise and then continue. |
155 |
151 |
199 type Ctrl-C to interrupt the command and get back the ``ipython`` input |
193 type Ctrl-C to interrupt the command and get back the ``ipython`` input |
200 prompt. |
194 prompt. |
201 |
195 |
202 Following is an exercise that you must do. |
196 Following is an exercise that you must do. |
203 |
197 |
204 .. #[[Anoop: add slide]] |
|
205 |
|
206 %%4%% Try typing round(2.484, and hit enter. and then cancel the |
198 %%4%% Try typing round(2.484, and hit enter. and then cancel the |
207 command using Ctrl-C. Then, type the command, round(2.484, 2) and |
199 command using Ctrl-C. Then, type the command, round(2.484, 2) and |
208 resume the video. |
200 resume the video. |
209 |
201 |
210 Please, pause the video here. Do the exercises and then continue. |
202 Please, pause the video here. Do the exercises and then continue. |
219 This brings us to the end of the tutorial on getting started with |
211 This brings us to the end of the tutorial on getting started with |
220 ``ipython``. |
212 ``ipython``. |
221 |
213 |
222 .. #[[Anoop: add slides for interrupts, navigating history, I feel |
214 .. #[[Anoop: add slides for interrupts, navigating history, I feel |
223 even a single point will also do]] |
215 even a single point will also do]] |
|
216 |
|
217 .. #[Puneeth: I don't feel these things cannot be shown on a slide.] |
224 |
218 |
225 In this tutorial we have learnt, how to |
219 In this tutorial we have learnt, how to |
226 {{{ show the outline/summary slide. }}} |
220 {{{ show the outline/summary slide. }}} |
227 |
221 |
228 1. invoke the ``ipython`` interpreter. |
222 1. invoke the ``ipython`` interpreter. |