Python Forum
Functions with conditionals and comparison operators
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Functions with conditionals and comparison operators
#2
You are detecting two evens correctly. Note that the other case is one or both are odd. Well, if it is not the case that both are even, then one or both are odd. There's no third possibility. So change the elif blah blah blah: to just a plain else.

The pass is not needed. If the code had gotten to that point, it would have done nothing anyway, which is what pass does.

Note that the assignment says to return a number. You are printing a number. That's not the same thing. I would replace print(a) with return a.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply


Messages In This Thread
RE: Functions with conditionals and comparison operators - by ichabod801 - Dec-20-2018, 03:49 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Meltdown Mitigation (operators + conditionals) beware: Exercism potential spoiler Drone4four 5 2,778 Feb-21-2022, 08:49 AM
Last Post: Gribouillis
  Need help with a homework problem on logical operators voodoo 3 4,695 Jun-28-2019, 03:45 PM
Last Post: jefsummers
  Guessing game with comparison operators Drone4four 9 13,987 Dec-02-2018, 06:12 PM
Last Post: ichabod801
  Nested Conditionals Elero 3 8,056 Apr-16-2018, 07:58 PM
Last Post: Elero
  Error with conditionals RiceGum 17 7,526 Oct-18-2017, 01:45 AM
Last Post: ichabod801

Forum Jump:

User Panel Messages

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