Math + Code Quiz Flashcards
View the flashcards tags for a the code.
What is the equation for the sum of the first natural numbers?
The sum of the first natural numbers is given by the formula:
What is the derivative of ?
The exponential function is its own derivative.
What does this Python expression return?
[x**2 for x in range(5)]
[0, 1, 4, 9, 16]
A list comprehension that squares each number from 0 to 4.
What is the output of this Python code?
d = {"a": 1, "b": 2}
print(d.get("c", 0))
0
dict.get(key, default) returns the default value when the key is missing instead of raising a KeyError.
What is Euler's identity?
It connects five fundamental constants: , , , , and .
How do you reverse a list in Python in place?
nums = [1, 2, 3, 4, 5]
nums.reverse()
# nums is now [5, 4, 3, 2, 1]
list.reverse() mutates the list and returns None.
What is the quadratic formula?
For :
What does zip do in Python?
list(zip([1,2,3], ["a","b","c"]))
[(1, 'a'), (2, 'b'), (3, 'c')]
zip pairs elements from multiple iterables by index.
What does a binary tree traversal look like?
In-order: D, B, E, A, F, C, G