4. Simple errors other ways to use "and"?


Hello All,

I have my code working. But I was wondering is there any way to express

while choice!= "y" and choice!= "n"

like combine them together instead of separately?

Thanks :stuck_out_tongue:


Hi @littlebirdalice ,

You could test for membership in a tuple or a list, as follows ...

while choice not in ("y", "n"):

... or ...

while choice not in ["y", "n"]:


perfect! thank you so much!! :stuck_out_tongue: