Skip to content

Instantly share code, notes, and snippets.

@grenade

grenade/q1.txt Secret

Last active December 25, 2015 06:18
Show Gist options
  • Save grenade/aaee942da0363fa31e12 to your computer and use it in GitHub Desktop.
Save grenade/aaee942da0363fa31e12 to your computer and use it in GitHub Desktop.
To complete the questionnaire, first fork it (to your own Github account), then simply edit each file to include your answers. Please avoid just copy/pasting your answers from the internet, we're well aware of the common answers out there. We're interested in your own answers and reasoning and your ability to demonstrate in-depth understanding r…
What are Python decorators and how would you use them?
How would you set up multiple python projects on the same computer using different python versions (and third party library versions) for each project?
# Demonstrate two ways of fetching every 3rd item in a list. Complete the code example below:
list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# print every third letter (method 1):
# print every third letter (method 2):
# What is the difference between lists and tuples?
# Write a short explanation here:
# Demonstrate an example of tuple usage (with a good use case for tuples over lists):
# What is the difference between range and xrange?
# Write a short explanation here:
# Use 'range' to print the first 5 letters of the alphabet. Complete the code example below:
list = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
# What is the 'with' construct used for?
# Write a short explanation here:
# Demonstrate use of the with construct in an example of your choice:
# Demonstrate two ways of determining if 'needle' occurs in 'haystack':
needle = 'jump'
haystack = 'The quick brown fox jumps over the lazy dog.'
# (method 1. The 'Pythonic' way):
# (method 2. 'Conventional' way):
Is Python pass-by-value or pass-by-reference? Explain your reasoning:
# Convert the following code to a list comprehension:
squares = []
for x in range(10):
squares.append(x**2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment