Skip to content

Instantly share code, notes, and snippets.

@benslv
Created September 7, 2018 10:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benslv/9fe9c2023404ab7a92eb07f43ad808a0 to your computer and use it in GitHub Desktop.
Save benslv/9fe9c2023404ab7a92eb07f43ad808a0 to your computer and use it in GitHub Desktop.
3. Less Than Ten
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for item in a:
if item < 5:
print(item)
b = []
for item in a:
if item < 5:
b.append(item)
print(b)
print([i for i in a if i < 5])
inpNumber = int(input("Please enter a number: "))
print([i for i in a if i < inpNumber])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment