Skip to content

Instantly share code, notes, and snippets.

Keybase proof

I hereby claim:

  • I am j-nordell on github.
  • I am jcnordell (https://keybase.io/jcnordell) on keybase.
  • I have a public key whose fingerprint is 70E5 CE37 D57E DA5A F6CA 76E7 8C41 B08D C8A7 A263

To claim this, I am signing this object:

@j-nordell
j-nordell / for-break.py
Last active November 6, 2017 13:58
Review break statements (for loop example)
cookie_jar = ["chocolate chip", "oatmeal raisin", "ginger",
"peanut butter", "sugar", "Oreo"] # I have these cookies in my cooke jar
for cookie in cookie_jar:
# (This may look complex, but don't worry about it right now.
# It just checks to see if we've tried half the cookies yet)
if cookie_jar.index(cookie) >= len(cookie_jar) / 2: # If we've already tasted half the cookies,
print("I've had enough cookies for today")
@j-nordell
j-nordell / for-continue.py
Created November 6, 2017 13:52
Review continue statement (for loops)
cookie_jar = ["chocolate chip", "oatmeal raisin", "ginger",
"peanut butter", "sugar", "Oreo"] # I have these cookies in my cooke jar
for cookie in cookie_jar: # Take every cookie in the jar one by one,
if cookie == "oatmeal raisin": # Make sure it isn't oatmeal rasin
print(f"I don't like {cookie} cookies")
continue # Skip it because I don't like oatmeal rasin
@j-nordell
j-nordell / for.py
Last active November 6, 2017 13:57
Introduction of for loop
cookie_jar = ["chocolate chip", "oatmeal raisin", "ginger",
"peanut butter", "sugar", "Oreo"] # I have these cookies in my cooke jar
for cookie in cookie_jar: # Take every cookie in the jar one by one,
print(f"The {cookie} cookie was delicious!") # and take a bite!
@j-nordell
j-nordell / while-continue.py
Created November 6, 2017 13:46
Introduction to continue statement (while example)
num_chips = 20 # There are usually 20 chips in a snack-sized bag of chips
while num_chips > 0: # While we still have chips,
num_chips -= 1 # Take one out of the bag
if num_chips == 3: # If it's a burnt chip (the bad chip is always at the bottom of the bag),
print("Eww") # Throw it away
continue # Move onto the next chip without eating it
@j-nordell
j-nordell / while-break.py
Created November 6, 2017 13:40
Introduction to break statements (while example)
num_chips = 20 # There are usually 20 chips in a snack-sized bag of chips
while num_chips > 0: # While we still have chips,
if num_chips == 10: # Make sure we still have enough to share
print("I should share these with a friend")
break # If not, pass it on to a friend
num_chips -= 1 # Otherwise, take a chip out of the bag
@j-nordell
j-nordell / while.py
Last active November 6, 2017 13:39
Introduction to while loops in Python
num_chips = 20 # There are usually 20 chips in a snack-sized bag of chips
while num_chips > 0: # While we still have chips,
num_chips -= 1 # Take one out of the bag,
print("Crunch!") # and eat it!

Keybase proof

I hereby claim:

  • I am j-nordell on github.
  • I am jcnordell (https://keybase.io/jcnordell) on keybase.
  • I have a public key whose fingerprint is 5E04 4776 D522 4D4B E706 E56D 64FB FCE2 FAE3 5A6C

To claim this, I am signing this object: