Free Online Flashcard Deck

03 — Python Programming Fundamentals Free Online FlashCards

Study 03 — Python Programming Fundamentals with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What does `=` mean in Python?

Back

Assignment evaluates the expression on the right and associates its result with the name on the left. The `=` symbol assigns a value; it does not test mathematical equality.

02
Front

Can a Python variable change type?

Back

A variable’s current value determines its type; the name itself is not permanently fixed to one type. For example, `item` can refer first to `10` and later to the string `"ten"`.

03
Front

What is multiple assignment?

Back

`width, height = 8, 5` assigns 8 to `width` and 5 to `height`. Multiple assignment can also exchange values, as in `left, right = right, left`.

04
Front

Why convert the result of `input()`?

Back

`input()` returns text, so numeric input must be converted before arithmetic. Use `int()` for whole numbers or `float()` for numbers that may contain a fractional part.

05
Front

What does an f-string do?

Back

An f-string inserts expressions inside braces, such as `f"{name} worked in {year}."`. It produces formatted text using the current values of those expressions.

06
Front

What do `//` and `%` return?

Back

`7 // 2` gives `3` because `//` performs floor division, while `7 % 2` gives `1`, the remainder after division.

07
Front

How do `=` and `==` differ?

Back

`=` assigns a value to a name, whereas `==` compares two values and produces a Boolean result such as `True` or `False`.

08
Front

How does an `if` chain choose a branch?

Back

In an `if`/`elif`/`else` chain, conditions are tested in order and at most one branch runs. The `else` branch runs only when all preceding conditions are false.

09
Front

Is `range()`'s endpoint included?

Back

The endpoint passed to `range()` is excluded. Therefore, `range(1, 4)` produces `1`, `2`, and `3`.

10
Front

What causes an infinite `while` loop?

Back

A `while` loop can run forever if its condition never becomes false. The loop body must change relevant state so that termination eventually becomes possible.

11
Front

How do `break` and `continue` differ?

Back

`break` immediately leaves the nearest loop. `continue` skips the rest of the current iteration and begins the next iteration.

12
Front

What is the difference between a parameter and an argument?

Back

In `def square(number):`, `number` is a parameter. In `square(6)`, `6` is the argument supplied to that parameter when the function is called.