WAP in python for mode of a list ?? NO SPAM OR REPORTED
Answers
Answered by
5
from statistics import mode
data = eval(input("Enter the data: "))
print(mode(data))
You'll first need to import the statistics package, that is available in most Python instalments. Once that's done, you can start typing out your program.
eval() lets users enter data as they are, be it an integer, string or float value.
According to the succeeding statements, it'll be processed.
Mode is the most repeated observation in the given data.
Answered by
2
Answer:
import statistics
lst = eval(input("Enter the List: "))
print("Mode of List :-",mode(lst))
Enter the List: [1,2,1,3,3,4,3,6,7]
Mode of List :- 3
✨
Attachments:
Similar questions