What is an expression in Python?
An expression is code evaluated to produce a value; it may contain literals, variables, operators, and function calls.
Study 03. Expressions and Boolean Logic with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What is an expression in Python?
An expression is code evaluated to produce a value; it may contain literals, variables, operators, and function calls.
In `a + b`, what are the operator and operands?
The operator performs the operation, while the operands are the values on which it operates. In `a + b`, `+` is the operator and `a` and `b` are operands.
What is the result of `7 // 2`?
`7 // 2` evaluates to `3` because floor division returns the floor of the quotient.
What does `7 % 2` evaluate to?
`7 % 2` evaluates to `1`; the `%` operator returns the remainder after division.
How do `=` and `==` differ in Python?
`=` assigns a value, while `==` tests whether two values are equal. For example, `x = 10` assigns; `x == 10` compares.
What does `10 <= score <= 20` mean?
The chained comparison is equivalent to `10 <= score and score <= 20`. It checks that `score` lies from 10 through 20, inclusive.
What do Python's `not`, `and`, and `or` operators do?
`not` reverses a truth value, `and` is true when both conditions are true, and `or` is true when at least one condition is true.
Which common Python values are false in a Boolean context?
`False`, `None`, numeric zero, and empty strings and containers are false in Boolean contexts; most other values are true.
When do `and` and `or` short-circuit?
`A and B` stops when `A` is false, while `A or B` stops when `A` is true, because the final result is already determined.
What can Python's `and` and `or` return?
Python's `and` and `or` return one of their operands, not necessarily `True` or `False`. Thus, `entered_name or "Guest"` produces `"Guest"` when `entered_name` is empty.
How does `+` combine strings in Python?
The `+` operator concatenates strings, and both operands must be strings. Convert other types with `str()` or use a formatted string.
What is the result of `"-" * 5`?
`"-" * 5` evaluates to `"-----"`; multiplying a string repeats it the specified number of times.
A practical review of the integrated Java skills, debugging habits, algorithm reasoning, and free-response strategies needed for AP Computer Science A.
A progressive guide to designing, operating, and testing systems that continue useful service despite component faults, overload, data loss, and recovery challenges.
A medium-difficulty quiz on how independently operated networks, protocols, addresses, naming systems, transport services, and routing mechanisms work together to form the Internet.
Learn how to create, modify, traverse, and analyze Java lists with ArrayList, wrapper types, standard algorithms, and the Collections utility class for AP Computer Science A.
Build a clear understanding of Java Boolean expressions, logical operators, selection statements, nested branching, equivalent logic, and systematic code tracing for AP Computer Science A.
A practical introduction to Java program structure, data types, operators, input and output, problem-solving strategy, testing, and debugging for AP Computer Science A.
A practical guide to Java inheritance, constructor chaining, method overriding, polymorphism, access control, and object behavior for tracing and writing AP Computer Science A programs.
A focused guide to Java classes, object references, constructors, methods, strings, wrapper classes, and API usage for AP Computer Science A.
A focused guide to Java primitive types, expression evaluation, numeric conversion, floating-point behavior, integer overflow, and common methods in the Math class for AP Computer Science A.
A focused review of Java primitive types, expression evaluation, numeric conversion, arithmetic behavior, Math methods, randomness, and tracing techniques for AP Computer Science A.
A progressive guide to how packet-switched networks encapsulate data, move it across links, and manage delay, throughput, queues, and congestion.
A structured guide to designing parallel and distributed systems through decomposition, communication, coordination, state management, scalability, and fault tolerance.