title: How to add odd numbers from a list in python?
body: <p><strong>Write a function that accepts a list of integers as parameter. Your function should return the sum of all the odd numbers in the list. If there are no odd numbers in the list, your function should return 0 as the sum.</strong> </p>
  
  <pre><code>def odd_numbers (my_list):
      total = 0
      count = 0
      for number in my_list:
          if (number % 2 == 1):
              total = total + number 
          else:
              count = count + 1
      if (number == count):
          return (0)
      else:
          return (total)
  
  #Main Program
  
  my_list = []
  n = int(input("Enter the maximum length of a list: "))
  while (len(my_list) &lt; n):
      item = input ("Enter integer value to the list: ")
      my_list.append(item)
  print ("This is your list: ", my_list)
  result = odd_numbers(my_list)
  print (result)
  </code></pre>
  
  <p>This is my program. When I execute it, there's an error at first if condition in the function odd_numbers and when I call the function from my main program. I can't understand the nature of this error. It just states that </p>
  
  <blockquote>
    <p>TypeError: not all arguments converted during string formatting</p>
  </blockquote>