1+1 text = 'We are the knights who say "ni"' for word in text.split(' '): if len(word)>3: text = text.replace(word, word.upper()) print(text) text = 'We are the knights who say "ni"' make_big = lambda x : x.upper() if len(x)>3 else x make_big("banana") big_words = map(make_big, text.split(' ')) print(' '.join(big_words)) class Text(): def __init__(self, content): self.content = content def make_big(self): for word in self.content.split(' '): if len(word)>3: self.content = self.content.replace(word, word.upper()) def __str__(self): return self.content text = Text('We are the knights who say "ni"') text.make_big() print(text) print(' '.join([word.upper() if len(word)>3 else word for word in 'We are the knights who say "ni"'.split(' ')])) from googlemaps import GoogleMaps gmaps = GoogleMaps() directions = gmaps.directions('Argentinienstrasse 8', 'Ottakringer Brauerei') #print(directions['Distance']) for step in directions['Directions']['Routes'][0]['Steps']: print(step['descriptionHtml']) import Image im = Image.open("data/lena.jpg") im.show() im.rotate(90).show() # if we want to rotate Lena to a horizontal position... import Image im = Image.open("data/lena.jpg") #im.show() # <- this is what you would normally do, but to embed it on a server I make it a bit more complicated: subplot(121) # 1 row, 2 columns, image 1 imshow(numpy.asarray(im)) # we convert an image to a numpy 2d array and plot it as an image im2 = im.rotate(90) # if we want to rotate Lena to a horizontal position... #im2.show() subplot(122) # 1 row, 2 columns, image 2 imshow(numpy.asarray(im2)) show() x = linspace(0, 2*pi) y = sin(x) plot(x,y) show() a=range(5) a.remove(3) print(a) y? def divide(): a = 1 b = 4 c = b / (a-1) divide() from IPython.lib.display import YouTubeVideo # I just learned about this very feature today from this video :) YouTubeVideo('HaS4NXxL5Qc')