Q:

how can i know how often (if statment are True) in my code?

Let's assume:
for a in range(10):
  if a == 2 or a == 5:
    print (how often this condition was True) 

of course will be two, in my code i want to know when my condition be True , thanks

A:

count = 0 # set a variable for counting

for a in range(10): 
  if a == 2 or a == 5: # for each entry that meets the condition
    count += 1         # add 1 to count
print(count)           # 2

