Created
October 22, 2024 07:00
-
-
Save georgesb/c9f9bf4f077648e8920fd6115777c372 to your computer and use it in GitHub Desktop.
Python loops - While and For
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
# while loop example | |
evens = 2 | |
while evens <= 10: | |
print evens | |
evens = evens + 2 | |
# for loop example, increment n by 1 | |
for n in range(1, 11): | |
print n | |
# for loop example, increment n by 2 | |
for n in range(2, 12,2): | |
print(n) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment