Last active
September 24, 2017 15:46
-
-
Save rnaeye/5c5e65170cceb68d7d1cfff9c6ae1eaa to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/python | |
mylist = a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
newList = [] | |
for item in mylist: | |
if item < 5: | |
print(item) | |
newList.append(item) | |
print(newList) | |
print("list comprehension:") | |
L = {x for x in mylist if x < 5} | |
print(L) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment