Automation, Orchestration, and Scripting
A monitoring script stores two integer values, used = 50 and total = 10, and then runs ratio = used / total in Python 3. What is the data type of ratio?
Show the answer
Correct answerB. Floating point
In Python 3, the / operator always returns a floating-point value, so ratio is 5.0 even though both operands are integers. Integer is tempting, but only the // floor-division operator keeps integer operands as an integer.