Skip to content

Commit

Permalink
Print_List_of_Even_Numbers.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mjrish96 authored Aug 1, 2017
1 parent 36ce63a commit 9e514c9
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions Print_List_of_Even_Numbers.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,10 @@
print [x for x in range(2, 100) if not x % 2]
print range(2, 100, 2)
def even(maxNum):
# Start with empty lists for even numbers
evens = []
# Loop through every integer up to the input maxNum
for num in range(1, maxNum + 1):
# Test if the number is even
if num % 2 == 0:
evens.append(num)
print("Evens:", evens)

0 comments on commit 9e514c9

Please sign in to comment.