Python Forum
Winning/Losing Message Error in Text based Game
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Winning/Losing Message Error in Text based Game
#3
Lists are not sets. They have an ordering. You are doing an equality test with a list, but that means the order has to be correct as well.

>>> ["a", "b"] == ["b", "a"]
False
If you don't care about the order, make your inventory a set. You can still add and remove items, but order is no longer important.

>>> {"a", "b"} == {"b", "a"}
True
jefsummers likes this post
Reply


Messages In This Thread
RE: Winning/Losing Message Error in Text based Game - by bowlofred - Dec-14-2020, 12:25 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Error message about iid from RandomizedSearchCV Visiting 2 1,012 Aug-17-2023, 07:53 PM
Last Post: Visiting
  Color a table cell based on specific text Creepy 11 1,964 Jul-27-2023, 02:48 PM
Last Post: deanhystad
  Another Error message. the_jl_zone 2 977 Mar-06-2023, 10:23 PM
Last Post: the_jl_zone
  Sending Whatsapp Message in the text file ebincharles869 9 3,520 Jun-21-2022, 04:26 PM
Last Post: snippsat
  select Eof extension files based on text list of filenames with if condition RolanRoll 1 1,511 Apr-04-2022, 09:29 PM
Last Post: Larz60+
  Extracting Specific Lines from text file based on content. jokerfmj 8 2,955 Mar-28-2022, 03:38 PM
Last Post: snippsat
  Mysql error message: Lost connection to MySQL server during query tomtom 6 16,001 Feb-09-2022, 09:55 AM
Last Post: ibreeden
  understanding error message krlosbatist 1 1,904 Oct-24-2021, 08:34 PM
Last Post: Gribouillis
  Extract text based on postion and pattern guddu_12 2 1,630 Sep-27-2021, 08:32 PM
Last Post: guddu_12
  Error message pybits 1 40,330 May-29-2021, 10:26 AM
Last Post: snippsat

Forum Jump:

User Panel Messages

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