I am Python newbie, so maybe don’t knew if this is obvious or not.
In Javascript a||b returns a if a is evaluated to true, else returns b.
Is that possible in Python other than lengthy if else statement.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I believe this is correct:
Proof
This is how “
||” works in JavaScript:This is how “
or” works in Python: