Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Nested Conditionals
#3
(Apr-16-2018, 05:19 PM)Elero Wrote: birds = ("Pigeon, Eagle, Parrot, Chicken, Turkey, Macaw, Duck, Geese")
Ok, so that's not a list, or tuple, of birds. It's a single string.
If you fix that, the rest of your code might work.

(Apr-16-2018, 05:19 PM)Elero Wrote: if last_guess.title() in birds == False:
This is a bit of a nitpick, but there's no reason to have the == False there. The in operator already returns True/False, so it's redundant, and makes the code a little harder to read.
Reply


Messages In This Thread
Nested Conditionals - by Elero - Apr-16-2018, 05:19 PM
RE: Nested Conditionals - by j.crater - Apr-16-2018, 06:02 PM
RE: Nested Conditionals - by Elero - Apr-16-2018, 07:58 PM
RE: Nested Conditionals - by nilamo - Apr-16-2018, 06:11 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Functions with conditionals and comparison operators Drone4four 9 16,196 Jan-01-2019, 06:48 PM
Last Post: Drone4four
  Error with conditionals RiceGum 17 9,966 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