Computer Science
On executing the following code, what output will be displayed?
statistics.mode([2.5, 3.2, 3.3, 2.5, 8.1, 9.9, 2.5, 5.1])
- 2.5
- 3.2
- 5.1
- 8.1
Python Modules
1 Like
Answer
2.5
Reason — The statistics.mode()
function returns the most frequent value in the list. In the list [2.5, 3.2, 3.3, 2.5, 8.1, 9.9, 2.5, 5.1], the value 2.5 appears most frequently (three times), so it is the mode.
Answered By
1 Like
Related Questions
What value will be displayed on executing the following arithmetic expression?
x = math.pow (0,-4)
- 1
- 16
- DomainError
- None of these
What output will be displayed after executing the following code?
statistics.median([11, 22, 33, 44, 55, 66])
- 28.5
- 38.5
- 5.5
- 6.5
What will the following code display on execution?
X = statistics.mean([2, 15, 6, 19])
- 10.5
- 10.6
- Error
- None of these
To include the use of functions which are present in the random library, we must use the option:
- import random
- random.h
- import.random
- random.random