What is a variable?
A variable is a named reference to a value, allowing a program to store information and use it later.
Study 02. Variables, Data Types, and Input–Output with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is a variable?
A variable is a named reference to a value, allowing a program to store information and use it later.
What naming convention uses underscores between words?
snake_case separates words with underscores, as in maximum_speed.
What rules apply to Python identifiers?
Python identifiers may contain letters, digits, and underscores, but cannot begin with a digit, use reserved keywords, or ignore case differences.
Which Python operator performs assignment?
The single equals sign (`=`) assigns the evaluated result on the right to the name on the left.
Which operator tests equality in Python?
The double equals operator (`==`) compares values and asks whether they are equal; it does not assign a value.
How does Python conventionally represent constants?
Python does not enforce constants directly. Programmers conventionally use uppercase names, such as DAYS_PER_WEEK, for values that should not change.
Which Python type represents whole numbers?
`int` represents an integer, or whole number, such as -4, 0, or 27.
Which Python type represents True or False?
`bool` represents a Boolean logical value: `True` or `False`.
What does a data type determine?
A data type describes the kind of value stored and the operations that can be performed on it.
Which function converts a value to an integer?
`int()` converts a value to an integer when possible, such as `int("42")`, which produces 42.
What type does Python input() return?
Python’s `input()` function returns the user’s entry as a string, even when the entry consists of digits.
What does Python’s print() function do?
`print()` writes values to standard output, such as the screen. It can display one or several values.