Advertisement
dprincef

Untitled

Feb 28th, 2020
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.34 KB | None | 0 0
  1. def only_odd(list): #Declares a only_odd function
  2.     m = [] #Creates an empty list
  3.     for i in list: #Implementation of the program that checks if an elemnt in the list is an odd number then return the elements
  4.         if i % 2 != 0:
  5.             m.append(i)
  6.     print(m)
  7. only_odd([1,2,3,4,5]) #Calls the only_odd function
  8. only_odd([2,4,6])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement