#!/usr/bin/env python #--*-- coding:utf-8 --*-- #version one """ from random import randint def odd(n): return n%2 allNums = [] for eachNum in range(9): allNums.append(randint(1,99)) print allNums print filter(odd,allNums) """ #version two """ from random import randint allNums = [] for eachNum in range(9): allNums.append(randint(1,99)) print allNums print filter(lambda n:n%2,allNums) """ #version three """ from random import randint allNums = [] for eachNum in range(9): allNums.append(randint(1,99)) print allNums print [n for n in allNums if n%2] """ #version four from random import randint as ri print [n for n in [ri(1,99) for i in range(9)] if n %2]