I'm a very beginner in python (I'm using python 3.7.4) and while coding, I can across a tedious situation while applying the condition in "if" statement as in the following code:
from array import *
ans = array('i')
for a in range(10):
for b in range(10):
for c in range(10):
if a == 5 or b == 5 or c == 5:
ans.append(100 * a + 10 * b + c)
for x in ans:
print(x)
To this I tried to attempt a solution by replacing the if- statement line as:
if (a or b or c) == 2:
But I miserably failed. Can anyone tell what this does? And can anyone provide me the best solution for my problem? I've shown an example of only one condition, whereas I've to put many of such conditions. Thank you for answering my query in advance!