Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Need help with basic code
#6
First of all, please use python code tags around your code
as to your question - non-empty list always evaluates to True, so both your if conditions are always true.

if x in n:
# do something here
elif x in y:
#do something else here
Reply


Messages In This Thread
Need help with basic code - by Random - Feb-07-2017, 05:58 AM
RE: Need help with basic code - by j.crater - Feb-07-2017, 06:22 AM
RE: Need help with basic code - by Random - Feb-07-2017, 06:27 AM
RE: Need help with basic code - by j.crater - Feb-07-2017, 06:45 AM
RE: Need help with basic code - by Random - Feb-07-2017, 07:02 AM
RE: Need help with basic code - by buran - Feb-07-2017, 07:03 AM
RE: Need help with basic code - by tannishpage - Feb-08-2017, 04:56 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  List index out of range error when attempting to make a basic shift code djwilson0495 4 3,062 Aug-16-2020, 08:56 PM
Last Post: deanhystad
  Writing a basic shift code djwilson0495 2 2,323 Aug-16-2020, 01:52 PM
Last Post: djwilson0495
  Problem with Basic Rock Paper Scissors code BirinderSingh 3 2,528 Sep-13-2019, 03:28 PM
Last Post: ichabod801
  basic code help chche5 4 5,489 Feb-17-2018, 10:24 PM
Last Post: chche5
  Basic Doubt in code prateek3 6 4,976 Aug-19-2017, 01:05 PM
Last Post: ichabod801
  Basic code help crawlinkingsnake 2 3,521 Jan-16-2017, 11:03 PM
Last Post: micseydel

Forum Jump:

User Panel Messages

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