Chapter 2 and 3 Flashcards
What function do you use to read a string?
input(“Enter a string”)
Result of eval(“1 + 3 * 2”)
7
____ is the code in natural language mixed with some program code.
Pseudocode
An identifier cannot be a keyword.
True
What is an identifier?
Identifier are names that identify elements such as variable and functions in a program (number1, number2, number3, average, input, eval)
An identifier can contain digits, but cannot start with a digit.
True
Which of the following is a valid identifier?
mile1 (Is not import because it is a keyword, which are reserved words)
If you enter 1 2 3 in separate lines, when you run this program, what will be displayed?
average = (number1 + number2 + number3) / 3
2.0 (Because / is floating point, // is integer)
What is the result of 45 / 4?
11.25
Value 1 means remainder of 1 when using %
Value 1 means remainder of 1 when using %
2 ** 3 evaluates to ___.
8 (An integer, not float point)
When x *= y + 1, formula is?
x = x (y + 1)
To add number to sum, you write:
sum += number (?)
min(3, 5, 1, 7, 4)
1 min is minimum
s is “Welcome.” What is s.upper()?
WELCOME