Created
December 3, 2023 21:19
-
-
Save dskecse/f58134c60ae44ba03b5d13f9813728b8 to your computer and use it in GitHub Desktop.
Revisions
-
dskecse created this gist
Dec 3, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,11 @@ from collections import defaultdict dict = defaultdict(lambda : 0) dict["a"] # => 0 dict.keys() # => dict_keys(['a']) print(dict.get("b")) # => None dict.keys() # => dict_keys(['a']) This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ hash = Hash.new(0) hash[:a] # => 0