Which of the following statements is false?
a. The following session defines a maximum function that determines and returns the largest of three values—then calls the function three times with integers, floating-point numbers and strings, respectively.
In [1]: def maximum(value1, value2, value3):
...: """Return the maximum of three values."""
...: max_value = value1
...: if value2 > max_value:
...: max_value = value2
...: if value3 > max_value:
...: max_value = value3
...: return max_value
...:
In [2]: maximum(12, 27, 36)
Out[2]: 36
In [3]: maximum(12.3, 45.6, 9.7)
Out[3]: 45.6
In [4]: maximum('yellow', 'red', 'orange')
Out[4]: 'yellow'
b. You also may call maximum with mixed types, such as ints and floats:
In [5]: maximum(13.5, -3, 7)
Out[5]: 13.5
c. The call maximum(13.5, 'hello', 7) results in TypeError because strings and numbers cannot be compared to one another with the greater-than (>) operator.
d. All of the above statements are true.
d. All of the above statements are true.
You might also like to view...
A(n) __________ allows a program to walk through the collection and remove elements from the collection.
a. Set. b. Queue. c. Iterator. d. List.
Write a push method for a stack implemented with an array. You may assume that the stack is referenced by an array named stack, and that there is an integer variable named count that keeps track of the number of elements in the stack. You may not assume that you have access to an expandCapacity method, nor should your code throw an exception if the stack is full. Your method should include code to expand the capacity of the array if it is full.
What will be an ideal response?
The World Wide Web Consortium has created a set of ____, or specifications, that all browser manufacturers follow.
A. indices B. standards C. sheets D. styles
You ____ a variable by assigning it a specific value when you declare it.
A. restore B. modify C. initialize D. delete