Write a Python program to print the even numbers from a given list


Introduction

Write a Python program to print the even numbers from a given list. I have used python 3.7 compiler for debugging purpose.


techstudy.org

HP 15 Core i3 7th gen Laptop(4GB, 1TB HDD, Windows 10) | Rs. 31,490

  1. def is_even_num(l):
  2. evennum = []
  3. for num in l:
  4. if num % 2 == 0:
  5. evennum.append(num)
  6. return evennum
  7. print(is_even_num([1, 2, 3, 4, 5, 6, 7, 8, 9]))
  8.  

Result

python language techstudy.org

     





Related Topics




Popular Posts