Which of the following statements a) , b) or c) 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.
Correct Answer:
Verified
Q1: Which of the following statements a), b)
Q2: Which of the following statements is false?
A)
Q3: Which of the following statements is
Q4: Which of the following statements is false?
A)
Q6: Which of the following statements is false?
A)
Q7: Which of the following statements a), b)
Q8: Which of the following statements is false?
A)
Q9: Which of the following statements is false?
A)
Q10: Which of the following statements is false?
A)
Q11: Assuming the following function definition, which of
Unlock this Answer For Free Now!
View this answer and more for free by performing one of the following actions
Scan the QR code to install the App and get 2 free unlocks
Unlock quizzes for free by uploading documents