equal
deleted
inserted
replaced
4 .. By the end of this tutorial, you will be able to |
4 .. By the end of this tutorial, you will be able to |
5 |
5 |
6 .. 1. Slice strings and get sub-strings out of them |
6 .. 1. Slice strings and get sub-strings out of them |
7 .. #. Reverse strings |
7 .. #. Reverse strings |
8 .. #. Replace characters in strings. |
8 .. #. Replace characters in strings. |
9 .. #. Convert to strings to upper or lower case |
9 .. #. Convert strings to upper or lower case |
10 .. #. joining a list of strings |
10 .. #. joining a list of strings |
11 |
11 |
12 .. Prerequisites |
12 .. Prerequisites |
13 .. ------------- |
13 .. ------------- |
14 |
14 |
82 using ``s[-1]``. |
82 using ``s[-1]``. |
83 |
83 |
84 Following is an exercise that you must do. |
84 Following is an exercise that you must do. |
85 |
85 |
86 %%1%% Obtain the sub-string excluding the first and last characters |
86 %%1%% Obtain the sub-string excluding the first and last characters |
87 from the string. |
87 from the string s. |
88 |
88 |
89 Please, pause the video here. Do the exercise(s) and then continue. |
89 Please, pause the video here. Do the exercise(s) and then continue. |
90 |
90 |
91 :: |
91 :: |
92 |
92 |
165 |
165 |
166 Please, pause the video here. Do the exercise and then continue. |
166 Please, pause the video here. Do the exercise and then continue. |
167 |
167 |
168 :: |
168 :: |
169 |
169 |
|
170 s in week |
|
171 |
170 s.lower()[:3] in week |
172 s.lower()[:3] in week |
171 |
173 |
172 We just convert any input string to lower case and then check if it is |
174 We just convert any input string to lower case and then check if it is |
173 present in the list ``week``. |
175 present in the list ``week``. |
174 |
176 |
189 email = email.replace("[at]", "@") |
191 email = email.replace("[at]", "@") |
190 print email |
192 print email |
191 |
193 |
192 Following is an exercise that you must do. |
194 Following is an exercise that you must do. |
193 |
195 |
194 %%3%% Replace the ``[dot]`` with ``.`` |
196 %%3%% Replace the ``[dot]`` with ``.`` in ``email`` |
195 |
197 |
196 Please, pause the video here. Do the exercise and then continue. |
198 Please, pause the video here. Do the exercise and then continue. |
197 |
199 |
198 :: |
200 :: |
199 |
201 |