Skip to content

Instantly share code, notes, and snippets.

@ryanorsinger
Created January 3, 2019 21:33
Show Gist options
  • Save ryanorsinger/af1c2f0a919cffab56ae6ef1c1acf61d to your computer and use it in GitHub Desktop.
Save ryanorsinger/af1c2f0a919cffab56ae6ef1c1acf61d to your computer and use it in GitHub Desktop.
Flashcards
# Flashcard Drills
4 in [1, 2, 3, 4]
list(range(1, 7))
[x for x in range(1, 5)]
[x*3 for x in range(1, 5)]
sum(range(1, 4))
# Given the following array, write the code that gets the first two elements in their own list.
fruits = ["mango", "kiwi", "apple", "guava"]
"a" in "banana"
"z" not in "banana"
"a" in list("banana")
list("banana")
tuple("banana")
total = 0
total += 2
total += 6
# what is total?
10 % 5
10 % 3
10 % 2
10 % 7
letters = ["a", "b", "c", "d", "e", "f"]
# what does letters[:3] return?
letters = ["a", "b", "c", "d", "e", "f"]
# what does letters[2:] return?
letters = ["a", "b", "c", "d", "e", "f"]
# what does letters[2:4] return?
"zipline"[-1:]
"zipline"[-2:]
"zipline"[-3:]
"zipline"[:-1]
"zipline"[:-2]
"zipline"[1:3]
letters = ["a", "b", "c", "d", "e", "f"]
# what does letters[-1:] return?
letters = ["a", "b", "c", "d", "e", "f"]
# what does letters[:-2] return?
letters = ["a", "b", "c", "d", "e", "f"]
# what does letters[-2:] return?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment