Do Now

  1. Copy and run the following code:

    single_fruit = ['apple', 'banana', 'watermelon', 'grape']
    multi_fruit = []
    multi_fruit.append(single_fruit[0] + 's')
    multi_fruit.append(single_fruit[1] + 's')
    multi_fruit.append(single_fruit[2] + 's')
    multi_fruit.append(single_fruit[3] + 's')
    print(multi_fruit)
    

    Briefly write down what happened. What would happen if you added 100 items to the list single_fruit? Write down how you would update multi_fruit.


  2. Copy and run the following code:

    list_of_numbers = [3, 5, 10, 23]
    for num in list_of_numbers: 
     print("num is " + str(num))
    

    Briefly write down what happened. How would this change if you added 100 items to list_of_numbers?


  3. Rewrite the code from part 1 using knowledge from part 2.