Can i code like this in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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
26th Jan 2022, 2:19 AM
NEZ
NEZ - avatar