Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Clear() Method | Dictionary
course content

Course Content

Python Data Structures

Clear() MethodClear() Method

Dictionaries also offer a handy clear() method that removes all items, leaving you with an empty dictionary. Here's how it works.

Let's put it to the test.

Task

Consider the dictionary below:

Your task is to clear out all the items in this dictionary.

Everything was clear?

Section 2. Chapter 8
toggle bottom row
course content

Course Content

Python Data Structures

Clear() MethodClear() Method

Dictionaries also offer a handy clear() method that removes all items, leaving you with an empty dictionary. Here's how it works.

Let's put it to the test.

Task

Consider the dictionary below:

Your task is to clear out all the items in this dictionary.

Everything was clear?

Section 2. Chapter 8
toggle bottom row
some-alt