Skip to content

Instantly share code, notes, and snippets.

@srahuliitb
Created August 29, 2017 04:17
Show Gist options
  • Select an option

  • Save srahuliitb/2608df37bb540aa35c6856883706a9e3 to your computer and use it in GitHub Desktop.

Select an option

Save srahuliitb/2608df37bb540aa35c6856883706a9e3 to your computer and use it in GitHub Desktop.
Take a list, say for example this one: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] and write a program that prints out all the elements of the list that are less than 5.
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
b = []
for i in a:
if i < 5:
b.append(i)
print b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment