Count Even Numbers User has Inputted PYTHON 3 -


i must create 2 functions. 1 can tell whether 1 number odd or returning t/f, , other call first function return how many numbers there are.

this code far:

    = [0,2,4,6,8]     iseveninput = int(input("please enter number: "))      def isevendigit(a):         if in even:             return true         else:             return false      y = isevendigit(iseveninput)     print(y)       def counteven(b):         count = 0         in b:             if isevendigit(a):                 count+=1         return count     d = input("please enter more 1 number: ")     y = counteven(d)     print(y) 

this keeps outputting 0 , doesn't count. doing wrong now?

here approach:

def is_even(number):     return number % 2 == 0  def even_count(numbers_list):     count = 0      number in numbers_list:         if is_even(number): count += 1      return count  raw_numbers = input("please enter more 1 number: ") numbers_list = [int(i) in raw_numbers.split()]  count = even_count(numbers_list) print(count) 

this take care of other numbers too.


Comments

Popular posts from this blog

matlab - Deleting rows with specific rules -

jquery - How would i go about shortening this code? And to cancel the previous click on click of new section? -