Free Online Flashcard Deck

02 Variables, Expressions, and Input/Output Free Online FlashCards

Study 02 Variables, Expressions, and Input/Output with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.

12 cards
01
Front

What is a variable?

Back

A variable is a name associated with a value so a program can use that value later.

02
Front

What does assignment do?

Back

Assignment evaluates the expression on the right and associates its resulting value with the target name. In Python, assignment uses =.

03
Front

What is a value?

Back

A value is a piece of data, such as a number, character sequence, or Boolean value.

04
Front

What is a Python constant?

Back

A constant is a value a program intends not to change. Python conventionally uses uppercase names, but does not enforce constancy.

05
Front

What is a literal?

Back

A literal is a value written directly in source code, such as 42, 3.14, "hello", True, or None.

06
Front

What is an expression?

Back

An expression is code that produces a value. Examples include 7, price, and price * quantity.

07
Front

What does += combine?

Back

Augmented assignment combines an operation with assignment; for example, count += 2 has the effect of count = count + 2.

08
Front

How do = and == differ?

Back

The == operator tests equality and produces a Boolean result, whereas = assigns a value and changes program state.

09
Front

Why use parentheses in expressions?

Back

Parentheses are evaluated first, followed by exponentiation, multiplication or division, addition or subtraction, comparisons, and logical operators.

10
Front

What is program state?

Back

Program state is the complete set of values that matter at a particular moment during execution. Assignments change that state.

11
Front

What type does input() return?

Back

Python's input() reads a line from standard input and returns it as a string, even when the user enters digits.

12
Front

How do you convert numeric input?

Back

Convert text with int() for integers or float() for floating-point numbers when arithmetic is needed; conversion can fail for invalid input.