Created
June 29, 2018 05:46
-
-
Save chookity-pokk/66dcb6e737d591b9560b2e018828e560 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
""" | |
Python program that prints out list elements less than a certain number | |
Hank Greenburg | |
Date: 6/28/2018 | |
""" | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
for element in a: | |
if element <= 5: | |
print(element) | |
#Above is my program and below is the exact solution. | |
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] | |
num = int(raw_input("Choose a number: ")) | |
new_list = [] | |
for i in a: | |
if i < num: | |
new_list.append(i) | |
print new_list |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment