Why doesn't this if statement work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why doesn't this if statement work

elif web != "www.sololearn.com" or "https://www.sololearn.com": ^ i input https://www.sololearn.com and got the Spoof Link, why? EDIT: even www.sololearn.com doesn't work https://code.sololearn.com/ck8Ruk2vhpgK/?ref=app

18th Feb 2019, 8:03 PM
TheCoder920
TheCoder920 - avatar
3 Answers
+ 4
Use "and" instead of "or" in if statement, because this way it can't be True, because it evaluates True only if string is both www.sololearn.com and https://www.sololearn.com which is impossible
18th Feb 2019, 8:21 PM
Maneren
Maneren - avatar
+ 3
TheCoder920 the condition should be: elif web != "www.sololearn.com" and web != 'https://www.sololearn.com': EDITED: Note the 'and' instead of 'or'.
18th Feb 2019, 8:30 PM
Ulisses Cruz
Ulisses Cruz - avatar
0
Awesome! It works!! Thanks people!!!
18th Feb 2019, 11:48 PM
TheCoder920
TheCoder920 - avatar