I am new to python and trying this code out
course = 'Python for Beginners'
print("Python is in text: " + 'Python' in course)
I know I can fix the code by adding a parenthesis around 'Python' in course
, however I would like to understand the mechanism.
Can any of you explain how the Python parses the code.
I see that Python can parse logical operators without Parenthesis i.e.
value = 15
print(value > 10 and value < 30)
I was expecting the Output
Python is in text: True
The Result I actually get is just the Boolean value below.
False
New contributor
user25235025 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.