Python code won't work

Bug description:

Expected vs Current Behavior:

Steps to reproduce:

Bug appears at this link: https://replit.com/@NoahGilmour/TestPlayground-2

Screenshot(s)/Screen Recording:

Browser/OS/Device: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/118.0.0.0 Safari/537.36

Replit Profile: https://replit.com/@NoahGilmour

You should replace the or with and on line 6 of your code

3 Likes

but then doesnt that mean that room has to be both “basic” and “premium” at the same time

Using and means that the input is not equal to premium AND not equal to basic, meaning it is equal to neither of them.

To avoid confusion, I would change line 6 to if not room in ["basic", "premium"]:

3 Likes

I’m dumb. You are right Thank you

Use room not in [...] instead of not room in [...]

1 Like

I think both should technically work.

1 Like

I know, but still, it reads a lot better

pep8 recommends x is not instead of not x is and this is pretty similar to that so

5 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.