Spring Deals - hours only!Up to 70% off on all courses and bundles.-Close
Introduction to nested lists
Iterating over nested lists
Modifying nested lists
Working with multiple lists
14. Copying nested lists – deepcopy


Excellent! If you don't feel like manually copying a nested list, you can use a ready-made function for that purpose:

import copy

donations = [
  [345.0, 287.80, 119.27, 329.30],
  [294.25, 349.0, 178.90, 262.34],
  [401.0, 456.45, 289.43, 319.27]

new_donations = copy.deepcopy(donations)

The easiest and most recommended way to copy a nested list is to import the copy module and use the deepcopy() function. There are a few other methods, but they use more advanced Python concepts.


Create a function named copy_all_caps(nested_list) that accepts a nested list of strings, as shown in the template code, and returns a new list with all strings printed in uppercase letters. Don't modify the input list.

Use the string_name.upper() method to turn all strings into uppercase letters.