title: Using Iterable and numeric as input in a function in python
body: <p>I've written a mean function in python </p>
  
  <pre><code>    def mean(*args):
          numbers = args
          sm=0
          length = len(numbers)
          if length&gt;0:
              for num in numbers:
                  sm = sm+num
              return sm/length  
          else:
              return 'FAIL'
  </code></pre>
  
  <p>which is working fine with numeric values. Now I want to modify it so that it also accepts iterables in the input.</p>
  
  <p>Modified function:</p>
  
  <pre><code>    def mean_new(*args):
          numbers = args
          sm=0
          count=0
          for num in numbers:
              if iter(num):
                  data = list(num)
                  sm += sum(data)
                  count+=len(data)
              else:
                  sm = sm+num
                  count+=1
      return sm/count
  </code></pre>
  
  <p>mean_new function is not working and giving me an error 'int' object is not iterable. Could you please help me identify what I'm doing wrong in the mean_new function. 
  mean_new function should work with both numeric and iterable input. </p>