Using OR in Python for a yes/no? -


i'm wanting have "y/n" in python, i've done, want user able input "y" or "y" , accepts both.

here's short if statement

if yn == "y":     break 

i'm wanting make this

if yn == "y" || "y":     break 

but "||" or operator in java. don't know or operator in python or if use this. help?

you're looking for

if yn in ("y", "y"): 

or better:

if yn.lower() == 'y': 

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -