Course Content
Python Data Structures
Python Data Structures
Clear() Method
Just like in other data structures, the clear()
method completely wipes out all the elements. Let's dive into the example below.
set_1 = {10, 'Joe', 'cat', True, 134} print(set_1) set_1.clear() print(set_1)
Task
You've got the set:
Your task is to erase all the items from this set.
Task
You've got the set:
Your task is to erase all the items from this set.
Everything was clear?
Clear() Method
Just like in other data structures, the clear()
method completely wipes out all the elements. Let's dive into the example below.
set_1 = {10, 'Joe', 'cat', True, 134} print(set_1) set_1.clear() print(set_1)
Task
You've got the set:
Your task is to erase all the items from this set.
Task
You've got the set:
Your task is to erase all the items from this set.
Everything was clear?
Clear() Method
Just like in other data structures, the clear()
method completely wipes out all the elements. Let's dive into the example below.
set_1 = {10, 'Joe', 'cat', True, 134} print(set_1) set_1.clear() print(set_1)
Task
You've got the set:
Your task is to erase all the items from this set.
Task
You've got the set:
Your task is to erase all the items from this set.
Everything was clear?
Just like in other data structures, the clear()
method completely wipes out all the elements. Let's dive into the example below.
set_1 = {10, 'Joe', 'cat', True, 134} print(set_1) set_1.clear() print(set_1)
Task
You've got the set:
Your task is to erase all the items from this set.