1/8
if i ace my exam im posting this public.
Name | Mastery | Learn | Test | Matching | Spaced |
|---|
No study sessions yet.
What data type does input() return?
The input() function in Python returns data as a string type, regardless of what the user enters.
What is a syntax error?
A syntax error occurs when the code violates the rules of the Python language, preventing it from being executed. This often involves mistakes in formatting, such as missing colons, parentheses, or indentation issues.
What is a sentinel value?
A sentinel value is a special, unique marker (like -1 or "exit") used in programming to signal the end of data or a condition, telling a loop to stop running, even when you don't know how many items are coming. It's a "flag" that's clearly different from real data, like entering "-1" to stop a list of positive scores.
What does len() do?
The len() function simply counts and returns the number of items in a collection, like characters in a text string ("hello" has a length of 5), items in a list ( [1,2,3] has a length of 3), or key-value pairs in a dictionary. It's a universal way to ask "how many?" for things that hold multiple elements.