Created
November 15, 2021 18:35
-
-
Save dcbriccetti/e3413578ad601a3bf1ef43debe33a757 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
for n in range(1, 11): | |
print(n) | |
# Display -5 to +5 | |
for n in range(-5, 6, 1): | |
print(n) | |
# Display even numbers from -2 to 6 | |
# Experiment with that 3rd argument | |
# 3rd argument: count by | |
for n in range(-2, 7, 2): | |
print(n) | |
# Display this series: | |
100, 200, ..., 1000 | |
for i in range(100, 1001, 100): | |
print(i) | |
# Display this series: | |
10, 8, ..., -2 | |
for x in range(10, -3, -2): | |
print(x) | |
for n in range(1, 11): | |
print(n, n % 2 == 0) # % is the modulo operator | |
if 5 == 5: | |
print('yes') | |
number = 10 | |
guess = 20 | |
# Write an if statement to determine if | |
# number equals guess | |
if number == guess: | |
print('right!') | |
for n in range(1, 11): | |
# print the even numbers | |
if n % 2 == 0: | |
print(n) | |
while True: | |
place = input('Where to? ') | |
if place == 'stop': | |
break | |
alive = True | |
while alive: | |
place = input('Where to? ') | |
if place == 'stop': | |
alive = False | |
# To stop this loop, enter an empty string | |
alive = True | |
while alive: | |
place = input('Where to? ') | |
if not place: | |
alive = False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment