Advertisement
Guest User

Untitled

a guest
Feb 27th, 2020
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.27 KB | None | 0 0
  1. #function to print only the odd numbers in a list of numbers
  2. def only_odds(nlist):
  3.     new_list = []
  4.     #iterating through the list of numbers
  5.     for number in nlist:
  6.         if number % 2 != 0:
  7.             new_list.append(number)
  8.     return new_list
  9. only_odds()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement