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


#1

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:


#2

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"]:

#3

perfect! thank you so much!! :stuck_out_tongue: