Q. Write a program to generate 6 random numbers and then print their mean, median and mode.
Answer :-
import random import statistics lst = [ ] for i in range(6) : n = random.randint( 0,10 ) # We take random number between 0 and 10 for better understanding lst.append( n ) print("Mean of number :- ", statistics.mean( lst ) ) print("Mode of number :- ", statistics.mode( lst ) ) print("Median of number :- ", statistics.median( lst ) )
Output :-
Mean of number :- 4.5
Mode of number :- 7
Median of number :- 5.5
>>>
Mean of number :- 5.333333333333333
Mode of number :- 6
Median of number :- 6.0
Mode of number :- 7
Median of number :- 5.5
>>>
Mean of number :- 5.333333333333333
Mode of number :- 6
Median of number :- 6.0
>>>
This solution is incomplete.
ReplyDeleteOk, I have completed it.
DeletePost a Comment
You can help us by Clicking on ads. ^_^
Please do not send spam comment : )