What does dynamically typed mean in Python?
Python is dynamically typed: a name has no permanently declared type and may later refer to a value of a different type.
Study 2 Variables and Data Types with 12 free online flashcards. Review key terms, definitions, and concepts with this interactive flashcard deck.
What does dynamically typed mean in Python?
Python is dynamically typed: a name has no permanently declared type and may later refer to a value of a different type.
What rules apply to Python names?
A Python name may contain letters, digits, and underscores, but it cannot begin with a digit. Names are case-sensitive, and keywords cannot be ordinary names.
How do `=` and `==` differ?
The operator `=` assigns or binds a value to a name; it does not test mathematical equality. The comparison operator `==` tests whether two values are equal.
What happens when a name is rebound?
Assignment can rebind a name. After `temperature = 18` followed by `temperature = 21`, the name `temperature` refers to `21`.
Why can `x, y = y, x` swap values?
In `x, y = y, x`, Python evaluates the right-hand side before assignments take effect, so the two values are swapped without a temporary variable.
How can you inspect an object's type?
The `type()` function inspects an object and reports its type, such as `int`, `float`, `str`, or `bool`.
What do `/`, `//`, `%`, and `**` do?
`/` performs ordinary division, `//` performs floor division, `%` returns the remainder, and `**` raises a value to a power.
What type does `input()` return?
`input()` returns a string. Convert it before numeric operations, such as with `age = int(input("Enter your age: "))`.
How does `int()` convert a float?
Converting a float to `int` discards the fractional part rather than rounding: `int(7.9)` is `7` and `int(-7.9)` is `-7`.
What does string immutability mean?
Strings are immutable Unicode sequences, so their contents cannot be changed in place. Create a new string instead, such as by concatenating text.
How does Python index strings?
Python strings use zero-based indexing: `word[0]` returns the first character. Negative indexing counts from the end, so `word[-1]` returns the last character.
What is an f-string used for?
An f-string inserts expressions directly into text, as in `f"You ordered {quantity} {item}s."`. It provides readable formatted output.
A 14-question medium-difficulty quiz on Boolean algebra, logic gates, truth tables, and combinational circuits.
A focused set of flashcards covering Python variables, data types, expressions, control flow, functions, input, output, and common programming practices.
Learn how Boolean expressions, logical operators, and conditional structures let programs make reliable decisions, including how to handle boundaries, branch order, and testing.
Learn how computer memory stores and addresses information, how RAM and ROM differ, and how caches and the memory hierarchy balance speed, capacity, and cost.
A progressive guide to tree structure, binary-tree traversals, binary search tree operations, deletion, balancing, and the way tree height determines time and space costs.
A practical guide to integrating problem definition, data representation, modular programming, algorithms, complexity analysis, testing, correctness, and ethical evaluation into a responsible computer science capstone.
Reviews how interrupts support event handling and multitasking, and how Linux system calls use the RISC-V `ecall` instruction and register conventions.
This quiz covers process management, context switching and scheduling, multitasking, traps and interrupts, and RISC-V privilege transitions.
A quiz on operating-system system calls, including privileged-operation requests, process creation and execution with fork, exec, and waitpid, and signal handling.