Skip to content

Instantly share code, notes, and snippets.

@odanga94
Created May 12, 2017 07:40
Show Gist options
  • Save odanga94/1acea2f964328f1db1a7493bb00e8342 to your computer and use it in GitHub Desktop.
Save odanga94/1acea2f964328f1db1a7493bb00e8342 to your computer and use it in GitHub Desktop.
PracticePython/Exercise3
# part 1
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89]
for item in a:
if item < 5:
print(item),
# part 2
b = [item for item in a if item < 5]
print("\n")
print(b)
#part 3
num = int(input("Enter your preferred number:"))
b = [item for item in a if item < num]
print(b)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment