author | anand |
Fri, 12 Nov 2010 01:00:49 +0530 | |
changeset 493 | 62b93bfac3cd |
parent 436 | e62bc810999c |
permissions | -rw-r--r-- |
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
1 |
#+LaTeX_CLASS: beamer |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
2 |
#+LaTeX_CLASS_OPTIONS: [presentation] |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
3 |
#+BEAMER_FRAME_LEVEL: 1 |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
4 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
5 |
#+BEAMER_HEADER_EXTRA: \usetheme{Warsaw}\usecolortheme{default}\useoutertheme{infolines}\setbeamercovered{transparent} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
6 |
#+COLUMNS: %45ITEM %10BEAMER_env(Env) %10BEAMER_envargs(Env Args) %4BEAMER_col(Col) %8BEAMER_extra(Extra) |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
7 |
#+PROPERTY: BEAMER_col_ALL 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 :ETC |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
8 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
9 |
#+LaTeX_CLASS: beamer |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
10 |
#+LaTeX_CLASS_OPTIONS: [presentation] |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
11 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
12 |
#+LaTeX_HEADER: \usepackage[english]{babel} \usepackage{ae,aecompl} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
13 |
#+LaTeX_HEADER: \usepackage{mathpazo,courier,euler} \usepackage[scaled=.95]{helvet} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
14 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
15 |
#+LaTeX_HEADER: \usepackage{listings} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
16 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
17 |
#+LaTeX_HEADER:\lstset{language=Python, basicstyle=\ttfamily\bfseries, |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
18 |
#+LaTeX_HEADER: commentstyle=\color{red}\itshape, stringstyle=\color{darkgreen}, |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
19 |
#+LaTeX_HEADER: showstringspaces=false, keywordstyle=\color{blue}\bfseries} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
20 |
|
436
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
21 |
#+TITLE: |
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
22 |
#+AUTHOR: FOSSEE |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
23 |
#+EMAIL: |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
24 |
#+DATE: |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
25 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
26 |
#+DESCRIPTION: |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
27 |
#+KEYWORDS: |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
28 |
#+LANGUAGE: en |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
29 |
#+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
30 |
#+OPTIONS: TeX:t LaTeX:nil skip:nil d:nil todo:nil pri:nil tags:not-in-toc |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
31 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
32 |
* Outline |
436
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
33 |
*** Defining strings |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
34 |
*** Concatenation |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
35 |
*** Accessing individual elements |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
36 |
*** Immutability of strings |
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
37 |
* Question 1 |
436
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
38 |
Obtain the string ~%% -------------------- %%~ (20 hyphens) without |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
39 |
typing out all the twenty hyphens. |
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
40 |
* Solution 1 |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
41 |
#+begin_src python |
436
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
42 |
s = "%% " + "-"*20 + " %%" |
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
43 |
#+end_src |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
44 |
* Question 2 |
436
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
45 |
Given a string, ~s~ which is ~Hello World~ , what is the output of:: |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
46 |
#+begin_src python |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
47 |
s[-5] |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
48 |
s[-10] |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
49 |
s[-15] |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
50 |
#+end_src |
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
51 |
* Solution 2 |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
52 |
#+begin_src python |
436
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
53 |
'W' |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
54 |
'e' |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
55 |
IndexError |
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
56 |
#+end_src |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
57 |
* Summary |
436
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
58 |
In this tutorial we have learnt |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
59 |
+ How to define strings |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
60 |
+ Different ways of defining a string |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
61 |
+ String concatenation and repetition |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
62 |
+ Accessing individual elements of the string |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
63 |
+ Immutability of strings |
e62bc810999c
Cleaned up getting started with strings LO.
Puneeth Chaganti <punchagan@fossee.in>
parents:
313
diff
changeset
|
64 |
|
313
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
65 |
* Thank you! |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
66 |
#+begin_latex |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
67 |
\begin{block}{} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
68 |
\begin{center} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
69 |
This spoken tutorial has been produced by the |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
70 |
\textcolor{blue}{FOSSEE} team, which is funded by the |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
71 |
\end{center} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
72 |
\begin{center} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
73 |
\textcolor{blue}{National Mission on Education through \\ |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
74 |
Information \& Communication Technology \\ |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
75 |
MHRD, Govt. of India}. |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
76 |
\end{center} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
77 |
\end{block} |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
78 |
#+end_latex |
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
79 |
|
b9b7bfce773e
Getting started with strings LO - script and questions.
Puneeth Chaganti <punchagan@fossee.in>
parents:
diff
changeset
|
80 |