Solved

Which of the Following Statements A), B) or C) Is

Question 5

Multiple Choice

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:

verifed

Verified

Unlock this answer now
Get Access to more Verified Answers free of charge

Related Questions

Unlock this Answer For Free Now!

View this answer and more for free by performing one of the following actions

qr-code

Scan the QR code to install the App and get 2 free unlocks

upload documents

Unlock quizzes for free by uploading documents