>>> print(type(AngkorWat))>>> print("Angkor wat is at latitude: {}".format(AngkorWat[0])) Angkor wat is at latitude: 13.4125 >>> print("Angkor wat is at longitude: {}".format(AngkorWat[1])) Angkor wat is at longitude: 103.866667
>>> dimensions = 52, 40, 100 >>> length, width, height = dimensions >>> print("the dimensions are {}x{}x{}".format(length, width, height)) the dimensions are 52x40x100
world_heritage_locations = {(13.4125, 103.866667): "Angkor Wat", (25.73333, 32.6): "Ancident Thebes", (30.330556, 35.4433330): "Petra", (-13.116667, -72.583333): "Machu Picchu"}
def box(width, height, symbol): print(symbol * width) for _ in range(height-2): print(symbol + " " * (width-2) + symbol) print(symbol + width)
def print_list(l, numbered, bullet_character): for index, element in enumerate(l): if numbered: print("{}: {}".format(index+1, element)) else: print("{} {}".format(bullet_character, element))
def word_count(document, search_term):
“”” Count how many times search_term appears in document. “””
words = document.split()
answer = 0
for word in words:
if word == search_term:
answer += 1
return answer
def nearest_square(limit):
“”” Find the largest square number smaller than limit.”””
answer = 0
while (answer+1)**2 < limit:
answer += 1
return answer**2
[/python]