title: What Is The Best Practice When it Comes To Determining and Counting Odd and Even Numbers in python
body: <p>For a recent assessment that I have completed in my studies, I have a piece of code that <strong>asks the user for four integers</strong>. Then the program must <strong>count and display the number of odd and even numbers in the entries</strong>. The code is as follows:</p>
  
  <pre><code># xx assignment 02 question 2
  a = int(input("Enter an integer number: "))
  b = int(input("Enter an integer number: "))
  c = int(input("Enter an integer number: "))
  d = int(input("Enter an integer number: "))
  e = 0
  o = 0
  
  if a % 2 == 0:
      e = e + 1
  else:
      o = o + 1
  if b % 2 == 0:
      e = e + 1
  else:
      o = o + 1
  if c % 2 == 0:
      e = e + 1
  else:
      o = o + 1
  if d % 2 == 0:
      e = e + 1
  else:
      o = o + 1
  
  print("Number of even numbers entered: ", e)
  print("Number of odd numbers entered: ", o)
  </code></pre>
  
  <p>The code I have works perfectly, I am not looking for a way to fix the code since it works. I would like to know if the reason for this exercise being marked is justified. </p>
  
  <p>The reason given for the mark is "Rather use a For loop than a series of if-else statements!!!!"</p>
  
  <p>Now, I understand that efficiency is a crucial part of programming, however the mark I got was a negative, although the task's goal was achieved. </p>
  
  <p>Since I just started learning Python, am I missing something here i.e. is there a standard approach that requires you to use a for loop when you want to compare user's input and then perform given tasks to receive the desiredoutput?</p>
  
  <p>Note: I'm not posting this to prove a point to somebody who is just following what they have done for the past few years, as I am learning and I might be wrong and I would like to know why. </p>