diff options
author | Jovina | 2011-05-25 16:29:48 +0530 |
---|---|---|
committer | Jovina | 2011-05-25 16:29:48 +0530 |
commit | 58cdb783e3e48d859cbc776373da257bf7b22cbe (patch) | |
tree | 2add894bf98e308e2080221e5dec8b2bb82f16e9 /getting_started_with_strings/slides.org | |
parent | 37051a2dc7b8c0cd47f2e91391612887c0f1adb9 (diff) | |
download | st-scripts-58cdb783e3e48d859cbc776373da257bf7b22cbe.tar.gz st-scripts-58cdb783e3e48d859cbc776373da257bf7b22cbe.tar.bz2 st-scripts-58cdb783e3e48d859cbc776373da257bf7b22cbe.zip |
Modified the scripts and slides in module 2.
Diffstat (limited to 'getting_started_with_strings/slides.org')
-rw-r--r-- | getting_started_with_strings/slides.org | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/getting_started_with_strings/slides.org b/getting_started_with_strings/slides.org index cd95474..e94a9b1 100644 --- a/getting_started_with_strings/slides.org +++ b/getting_started_with_strings/slides.org @@ -53,10 +53,10 @@ - Print a string repeatedly. - Access individual elements of the string. - Learn immutability of strings. -* Question 1 +* Exercise 1 Obtain the string ~%% -------------------- %%~ (20 hyphens) without typing out all the twenty hyphens. -* Question 2 +* Exercise 2 Given a string, ~s~ which is ~Hello World~ , what is the output of:: #+begin_src python s[-5] @@ -74,9 +74,11 @@ * Evaluation 1. Write code to assign s, the string ``' is called the apostrophe`` + 2. Given strings s and t, ``s = "Hello"`` and ``t = "World"`` and an integer r, ``r = 2``. What is the output of s * r + s * t? + 3. How will you change s='hello' to s='Hello'. - s[ 0 ]= H @@ -85,8 +87,10 @@ * Solutions 1. s = "` is called the apostrophe" + 2. HelloHelloWorldWorld + 3. Strings are immutable,hence cannot be manipulated. * |