List Comprehensions and Lambda Functions 3 of 13 · Deleting Dictionary Keys

Screen Link:

My Code:

Replace this line with your code

hn_clean = # Creating an empty list, hn_clean to store the cleaned data set and assign it to a variable, hn_clean

for row in hn:
cleaned_rows = row[0:]
def jprint(obj2):
text2 = json.dumps(obj2, sort_keys = True, indent = 4)
cleaned_rows = row[0:]

def del_key(dict_, key):
    modified_dict = dict_.copy()
    del modified_dict[key]
    return modified_dict
cleaned_rows = del_key(cleaned_rows, 'createdAtI')


What actually happened:

Do I still need to use this part of the code for this exercise?:

def jprint(obj):
    # Create a formatted string of the Python JSON object
    text = json.dumps(obj, sort_keys = True, indent = 4)

This is the correct answer for this exercise:

Thank you

Hey! Yes, you still need to use that part of code for your exercise. Don’t delete any previous code written in the exercise for a future reference.

1 Like