Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Output explanation
#2
stuff is a ductionary. dict is a data structure with key:values pairs. dict has .get(key, [default]) method. in this case get will look up for key 'candy' and will return respective value, but if there is no key 'candy' (as in this case) it will return the default value, which in this case is -1
Reply


Messages In This Thread
Output explanation - by AmanTripathi - Feb-07-2018, 07:39 PM
RE: Output explanation - by buran - Feb-07-2018, 07:57 PM
RE: Output explanation - by AmanTripathi - Feb-14-2018, 03:03 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  New learner in Python, and need help on the term explanation BaicaiPy 3 2,236 Oct-15-2022, 03:31 PM
Last Post: Yoriz
  Some line code explanation Chrilo06 3 3,296 Feb-24-2022, 06:24 PM
Last Post: deanhystad
  XOR solution explanation needed. omm 7 4,808 Oct-26-2020, 06:30 AM
Last Post: omm
  While statement explanation alkhufu2 3 3,327 Sep-02-2020, 05:46 PM
Last Post: alkhufu2
  need help with some explanation vincelim99 2 4,394 Mar-24-2017, 04:12 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020