+ 1
Is it possible to have multiple and/or statements in one if statement? The code says the last "and" is an invalid syntax
if day >=20 <=31 and month ==1 or day >=1<=18 and month==2 print("Aquarius")
3 Réponses
+ 1
yes. but you have wrong syntax.
For Between : correct syntax is
20 <= day <= 31 # day between 20 and 31
1 <= day <= 18 # both end values inclusive
edit:
if ( 20 <= day <=31 and month ==1 ) or ( 1 <= day <=18 and month==2 ) :
print("Aquarius")
+ 1
Thank you
0
You may need to use parentheses to group together statements.