Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
My code doesn't work.
#2
Hello and welcome to the forum!
Please use code tags to make your post/code more readable, you can edit the current post.
Your if statement:
if choice.lower() != "a" and choice.lower() != "b" and choice.lower() != "c" and choice.lower() != "d":
only gets executed if you enter something that is not a,b,c or d.
Also after fixing this you will probably not get expected results, due to your order of if statements and variables declared (only) within them. You would do better to include also elif/else statements. Take a quick look into some docs on if statements, and you will understand perfectly. =)

P.S.:
It would be better to pick a more descriptive thread title.
Reply


Messages In This Thread
My code doesn't work. - by Loueegee - Jan-18-2017, 11:10 AM
RE: My code doesn't work. - by j.crater - Jan-18-2017, 11:30 AM
RE: My code doesn't work. - by Larz60+ - Jan-18-2017, 12:46 PM
RE: My code doesn't work. - by Loueegee - Jan-20-2017, 01:30 PM
RE: My code doesn't work. - by buran - Jan-20-2017, 01:46 PM
RE: My code doesn't work. - by wavic - Jan-20-2017, 02:17 PM
RE: My code doesn't work. - by Windspar - Jan-20-2017, 02:24 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Extending list doesn't work as expected mmhmjanssen 2 223 May-09-2024, 05:39 PM
Last Post: Pedroski55
  hi need help to make this code work correctly atulkul1985 5 870 Nov-20-2023, 04:38 PM
Last Post: deanhystad
  newbie question - can't make code work tronic72 2 735 Oct-22-2023, 09:08 PM
Last Post: tronic72
  Why doesn't calling a parent constructor work with arbitrary keyword arguments? PurposefulCoder 4 1,002 Jun-24-2023, 02:14 PM
Last Post: deanhystad
  Code works but doesn't give the right results colin_dent 2 766 Jun-22-2023, 06:04 PM
Last Post: jefsummers
  Beginner: Code not work when longer list raiviscoding 2 869 May-19-2023, 11:19 AM
Last Post: deanhystad
  Why doesn't this code work? What is wrong with path? Melcu54 7 1,919 Jan-29-2023, 06:24 PM
Last Post: Melcu54
  Code used to work 100%, now sometimes works! muzicman0 5 1,532 Jan-13-2023, 05:09 PM
Last Post: muzicman0
  color code doesn't work harryvl 1 946 Dec-29-2022, 08:59 PM
Last Post: deanhystad
  Something the code dont work AlexPython 13 2,379 Oct-17-2022, 08:34 PM
Last Post: AlexPython

Forum Jump:

User Panel Messages

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