What is the difference between syntax and semantics?
Syntax is the set of rules for writing valid code; semantics is what correctly written code means when it runs.
Study 3 Programming Fundamentals with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is the difference between syntax and semantics?
Syntax is the set of rules for writing valid code; semantics is what correctly written code means when it runs.
What is a variable?
A variable is a name associated with a value. Assignment creates or changes that association.
Which operator tests equality in Python?
Use `==` to test equality. A single `=` assigns a value to a name.
Name five basic Python data values or types.
An integer is a whole number; a float has a fractional part; a string is text; a Boolean is `True` or `False`; `None` represents absence of a value.
How does Python conventionally represent a constant?
A constant is a value intended not to change during execution. Python commonly signals this intention with uppercase names, but does not enforce it.
What is an expression?
An expression is code that produces or computes a value; it can contain literals, variables, operators, and function calls.
What is a statement?
A statement is an instruction that performs an action, such as assigning a value, displaying output, importing a module, or controlling execution.
What does indentation organize in Python?
Python uses indentation to show which statements belong to a compound-statement block, such as an `if`, `for`, or `while` block.
What type does `input()` return?
`input()` returns the user’s response as a string, even when the response represents a number.
What does `print()` do?
`print()` writes values to standard output. Multiple arguments are separated by spaces by default.
How does a Python comment work?
A comment begins with `#` and is intended for human readers; Python normally ignores it during execution.
What distinguishes a docstring from a `#` comment?
A docstring is a string associated with a function, class, or module for documentation; it is not the same as a regular `#` comment.