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