0

Can i code like this in python

If 60<x<70: Print(”hello”) Or should it be If 60<x && x<70: Print(”hello”) Similar to c# In that case what is the equivalent of && in python?

26th Jan 2022, 2:09 AM
Lenoname
2 Answers
+ 6
In Python, you can do it in both ways as well. 60 < x < 70 or 60 < x and x < 70 `&&` operator is known as logical and operator in other languages while Python just uses `and`
26th Jan 2022, 2:17 AM
Simba
Simba - avatar
+ 2
Lenoname there is no && operator in Python, try using google too, see what I found: https://stackoverflow.com/questions/2485466/pythons-equivalent-of-logical-and-in-an-if-statement
26th Jan 2022, 2:19 AM
NEZ
NEZ - avatar