4-1
pizzas = ['dasd', 'gthy', 'hyt', 'oiuy']
for pizza in pizzas:
print(pizza)
for pizza in pizzas:
print("I like "+pizza+"pizza.")
print("I really love pizza!")
4-3~4-9
for i in range(1, 4):
print(i)
three = [value**3 for value in range(1,5)]
print(three)
4-10
names = ['Karry', 'Roy', 'Jackson', 'Leo', 'Nemo', 'Lucky']
print("Total list is:")
print(names)
print("The first three items in the list are:")
print(names[:3])
print("The last three items in the list are:")
print(names[-3:])
print("Three items from the middle of the list are:")
print(names[2:5])
4-11
pizzas = ['dasd', 'gthy', 'hyt', 'oiuy']
friend_pizzas = pizzas[:]
pizzas.append('bcshj')
friend_pizzas.append('ql')
print("My favorite pizzas are:")
for pizza in pizzas:
print(pizza)
print("My frined's favorite pizzas are:")
for pizza in friend_pizzas:
print(pizza)
4-13
foods = ('dsdf', 'rew', 'eret', 'oiu', 'cvx')
for food in foods:
print(food)
print("After some change:")
foods = ('akj', 'rew', 'eret', 'pijdhf', 'cvx')
for food in foods:
print(food)