Python Forum
Functions and if elif problem
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions and if elif problem
#2
Of course it does. On line 9 (and the others really), your condition is wrong. You need to write month == "September" or month == "October" or month == "November".

Non-empty strings evaluate to True, so if month isn't "September", the string "October" is tested and since that evaluates to True (the term used is "truthy") line 10 is executed. See the docs for more info.
Bruizeh likes this post
Reply


Messages In This Thread
Functions and if elif problem - by Bruizeh - Apr-21-2021, 12:11 AM
RE: Functions and if elif problem - by ndc85430 - Apr-21-2021, 04:34 AM
RE: Functions and if elif problem - by naughtyCat - Aug-27-2021, 03:37 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Simple problem with functions and returns danlopek14q 10 9,814 Mar-17-2021, 05:32 PM
Last Post: danlopek14q
  problem with elif? Osires 5 6,963 Sep-09-2017, 06:33 PM
Last Post: Osires

Forum Jump:

User Panel Messages

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