0

Can I mix conditions? If yes, how?

lol = 55 if lol > 5: print("Bigger than 5") if lol <= 50: print ("Between 5 and 50") if lol > 50 and I want to bring something that is not five, what could I do?

10th May 2018, 11:37 AM
Paloma Leite Costa
Paloma Leite Costa - avatar
3 Respuestas
+ 3
Sorry but if lol > 50 then lol cannot be 5.... I misunderstanding your question? Anyway if you have to check that two conditions are EITHER true you can use and operator (in python that roughly correspond to && operator in other languages): if lol>5 and lol<=50: print(""Between 5 and 50") Else if you want check that LEAST ONE OF condition is true you can use python or operator (|| in other languages): if lol==-5 or lol>0: print("lol is -5 OR is a positive number")
10th May 2018, 11:47 AM
KrOW
KrOW - avatar
+ 1
if lol >5 && lol<=50
10th May 2018, 11:40 AM
‎ ‏‏‎Anonymous Guy
0
Thank you guys!! I made the questions before understand the order of conditions. But all your questions thought me a lot too!! Jan Markus you made really clear to understand!! KrOW and Sreejith thank you too!
10th May 2018, 12:06 PM
Paloma Leite Costa
Paloma Leite Costa - avatar