Advertisement
Alihaydar

My solution to challenge

Apr 10th, 2019
525
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. def_dict = defaultdict(lambda: {"value": "", "isIncreased": False, "isDecreased": False})
  2. my_dict = defaultdict(lambda: def_dict)
  3. # PyCharm raises warning for two lines below, but it works
  4. my_dict['current_half_over_under'] = defaultdict(lambda: def_dict)
  5. my_dict['full_time_over_under'] = defaultdict(lambda: def_dict)
  6. # And to set "handicap" keys in "full_time_over_under" and "current_half_over_under" dictionaries we should access it via
  7. # my_dict.setdefault('handicap', some_value)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement