str1 = "Hello"
str2 = "there"
str3 = 'there'
bob = str1 + str2 + str3
print(bob)
Hellotherethere
x = '40'
y = int(x) +2
print(y)
42
x = 'From marquard@uct.ac.za'
print(x[8])
print(x[-1])
print(x[9])
print(x[14:17])
q
a
u
uct
for letter in 'banana':
print(letter)
b
a
n
a
n
a
print(len('banana')*7)
42
greet = 'hello bob'
print(greet.upper())
HELLO BOB
data = 'From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008'
pos = data.find('.')
print(data[pos:pos+3])
.ma
fruit = 'banana'
'n' in fruit
True
text = "X-DSPAM-Confidence: 0.8475";
ipos = text.find(':')
print(ipos)
18
text = "X-DSPAM-Confidence: 0.8475";
ipos = text.find(':')
piece = text[ipos+5:]
value = float(piece)
print(value)
0.8475
greet = ' hello bob '
print(greet.lstrip())
print(greet.rstrip())
print(greet.strip())
hello bob
hello bob
hello bob