#!/usr/bin/env python # coding: utf-8 # # Practice Problems # ### Lecture 3 # Answer each number in a separate cell # # Rename this notebook with your last name, first initial and the (2 digit) lecture number. # # ex. Cych_B_03 # # Turn in this notebook on Canvas. # ### Oceans and Continents # 1. Conceptual # - Give an example of when you would use a set # - Give an example of when you would use a tuple # - Give an example of when you would use range( ) # 2. Lists # - Create an empty list called _oceans_ # - append all the oceans to the list # - print the ocean at **index** 3 in the list # - print the last element of your list. # - make a shallow copy of _oceans_ called _seas_ and a deep copy of _oceans_ called _big_water_. Try to modify the copies. Verify that the shallow copy refers to the same underlying object while the deep copy makes an independent object. # - Apply the method **.sort()** to one of your copies and then print the copy # 3. range( ) # - Use the function **range( )** to create a list with a “range” of numbers from 0 up to (but not including) 100, increment by any number (less than 100) and print the results. # 4. Tuples # - Create a tuple called _continents_ with the continents as elements. # - Attempt to change the second **element** (not index) in place (this should throw and error). # - print out the third **element** (not index) in the tuple # 5. Sets # - create a set from the _oceans_ list you created earlier. # - print out the set of oceans # In[ ]: