> Source URL: /demos/flashcards.demo
# Math + Code Quiz Flashcards

View the [flashcards tags](./flashcards.tags.md) for a the code.
<grid cols="3" gap="4">

<flashcard>
<front>

What is the equation for the sum of the first $n$ natural numbers?

</front>
<back>

The sum of the first $n$ natural numbers is given by the formula:

$$
\sum_{i=1}^{n} i = \frac{n(n+1)}{2}
$$

</back>
</flashcard>

<flashcard>
<front>What does the **Pythagorean theorem** state?</front>
<back>
For a right triangle with legs $a$ and $b$ and hypotenuse $c$:

$$
a^2 + b^2 = c^2
$$

</back>
</flashcard>

<flashcard>
<front>

What is the derivative of $e^x$?

</front>
<back>

$$
\frac{d}{dx} e^x = e^x
$$

The exponential function is its own derivative.

</back>
</flashcard>

<flashcard>
<front>

What does this Python expression return?

```python
[x**2 for x in range(5)]
```

</front>
<back>

```python
[0, 1, 4, 9, 16]
```

A list comprehension that squares each number from 0 to 4.

</back>
</flashcard>

<flashcard>
<front>

What is the output of this Python code?

```python
d = {"a": 1, "b": 2}
print(d.get("c", 0))
```

</front>
<back>

```python
0
```

`dict.get(key, default)` returns the default value when the key is missing instead of raising a `KeyError`.

</back>
</flashcard>

<flashcard>
<front>

What is Euler's identity?

</front>
<back>

$$
e^{i\pi} + 1 = 0
$$

It connects five fundamental constants: $e$, $i$, $\pi$, $1$, and $0$.

</back>
</flashcard>

<flashcard>
<front>

How do you reverse a list in Python **in place**?

</front>
<back>

```python
nums = [1, 2, 3, 4, 5]
nums.reverse()
# nums is now [5, 4, 3, 2, 1]
```

`list.reverse()` mutates the list and returns `None`.

</back>
</flashcard>

<flashcard>
<front>

What is the **quadratic formula**?

</front>
<back>

For $ax^2 + bx + c = 0$:

$$
x = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}
$$

</back>
</flashcard>

<flashcard>
<front>

What does `zip` do in Python?

```python
list(zip([1,2,3], ["a","b","c"]))
```

</front>
<back>

```python
[(1, 'a'), (2, 'b'), (3, 'c')]
```

`zip` pairs elements from multiple iterables by index.

</back>
</flashcard>

<flashcard>
<front>

What does a **binary tree traversal** look like?

</front>
<back>

```mermaid
graph TD
    A[Root] --> B[Left]
    A --> C[Right]
    B --> D[L-Left]
    B --> E[L-Right]
    C --> F[R-Left]
    C --> G[R-Right]
```

**In-order**: D, B, E, A, F, C, G

</back>
</flashcard>
</grid>
---


---

## Backlinks

The following sources link to this document:

- [Flashcards](/index.path.llm.md)
- [flashcards demo](/demos/flashcards.tags.llm.md)
