Python Forum
Dictionary lookups exercise (PyBite #109)
Thread Rating:
  • 3 Vote(s) - 2.67 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Dictionary lookups exercise (PyBite #109)
#4
(Jul-03-2020, 02:00 PM)Drone4four Wrote: day = 'Saturday'.lower()
...
if WORKOUT_SCHEDULE_LOWER[day] == ('monday', 'tuesday', 'wednesday', 'thursday', 'friday'):
As "day" = 'saturday', WORKOUT_SCHEDULE_LOWER[day] will be evaluated to: 'Rest'. So the whole line will be evaluated to:
if 'Rest' == ('monday', 'tuesday', 'wednesday', 'thursday', 'friday'):
Reply


Messages In This Thread
RE: Dictionary lookups exercise (PyBite #109) - by ibreeden - Jul-03-2020, 02:41 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Type conversion and exception handling (PyBite #110) Drone4four 5 38,423 Jul-27-2020, 11:33 AM
Last Post: DeaD_EyE
  Iterating over dictionaries with the namedtuple function (PyBite #108) Drone4four 7 4,949 Jul-15-2020, 04:23 AM
Last Post: ndc85430
  Dictionary based exercise garvind25 2 2,042 Jul-12-2020, 06:53 PM
Last Post: garvind25
  "Slicing and dicing strings" - - PyBite #105 Drone4four 8 4,567 Jun-11-2020, 09:28 PM
Last Post: knackwurstbagel

Forum Jump:

User Panel Messages

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