Skip to content

Commit c74de53

Browse files
committed
Update funcWithSetsAndDict.rst
added drag and driop
1 parent a13b2cc commit c74de53

1 file changed

Lines changed: 17 additions & 3 deletions

File tree

_sources/functions/funcWithSetsAndDict.rst

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ Sets Do Not Allow Duplicates
118118
.. mchoice:: funct_set_add_dup_mc
119119
:practice: T
120120

121-
What values will be printed last from the code below?
121+
What values will be printed last when the code below is run?
122122

123123
- Nothing will print. You will get an error since you are trying to add a duplicate item to a set.
124124

@@ -245,6 +245,7 @@ You can use the following methods with sets.
245245
# define two sets
246246
s1 = {1, 2, 3}
247247
s2 = {3, 4, 5}
248+
s3 = {1, 3}
248249

249250
print(s1.issuperset(s3))
250251
print(s1 >= s3)
@@ -260,6 +261,18 @@ You can use the following methods with sets.
260261
- :\^: Use a ^ to indicate the symmetric difference between two sets (exclusive or)
261262
:.*: Which gives the same output as the symmetric_difference method?
262263

264+
.. dragndrop:: funct_set_methods_dnd
265+
:practice: T
266+
:feedback: Read this page and try again.
267+
:match_1: &||| intersection
268+
:match_2: <=||| issubset
269+
:match_3: \|||| union
270+
:match_4: >=||| issuperset
271+
:match_5: \-||| difference
272+
:match_6: \^||| symmetric_difference
273+
274+
Drag each symbol to the method it is equivalent to.
275+
263276

264277
Creating Sets
265278
================
@@ -301,10 +314,11 @@ Sorting Sets
301314
s2 = {"way", "back", "home"}
302315
print(s2)
303316
print(sorted(s2))
317+
print(s2)
304318

305319
.. Note::
306320

307-
The function sorted(set) will return a sorted list in ascending order.
321+
The function sorted(set) will return a new sorted list in ascending order.
308322

309323

310324
Dictionaries
@@ -395,7 +409,7 @@ There is another way to update the value for a key that works even if the key is
395409
:match_4: {1, 2, 3}||| Set
396410
:match_5: {"a": 5, "b": 2}|||Dictionary
397411

398-
Drag each item to its type.
412+
Drag each object to its type.
399413

400414
.. mchoice:: funct_set_dict_which_are_immutable_mc
401415
:practice: T

0 commit comments

Comments
 (0)