Computer Science, asked by rishavsharma21pd1prg, 10 months ago

WAP in python for mode of a list ?? NO SPAM OR REPORTED

Answers

Answered by Equestriadash
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 harshvirsing55
2

Answer:

\red{\fbox{\tt PROGRAM IN PYTHON LANGUAGE}}

import statistics

lst = eval(input("Enter the List: "))

print("Mode of List :-",mode(lst))

\blue{\fbox{\tt O U T P U T}}

Enter the List: [1,2,1,3,3,4,3,6,7]

Mode of List :- 3

\orange{\tt Hope it will} \green{\tt help you.}

Attachments:
Similar questions