Created
May 12, 2017 07:40
-
-
Save odanga94/1acea2f964328f1db1a7493bb00e8342 to your computer and use it in GitHub Desktop.
PracticePython/Exercise3
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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