+ 6
Is there any other way to solve this without calling "mean()" function twice in 8th no line?
8 odpowiedzi
+ 2
You can calculate all the means first:
means = [(name, mean(scores)) for (name, scores) in input.items()]
and then get the biggest mean with the max function:
maximum = max(means, key=lambda x: x[1])
+ 7
https://code.sololearn.com/cEE4CcoU7WNP/?ref=app
you pay with memory space
+ 4
Sayan Kundu no prob!
all students with highscore are printed
+ 2
This is the best I can do, though it's still probably not quite what you wanted :(
https://code.sololearn.com/cKC3Lr8XfKFf/?ref=app
Edited code to my actual attempt. For some reason, my saved code was identical to yours Sayan Kundu !
+ 1
Schindlabua Oma Falk But, in the input dictionary more than one student have highest score. So the output could be a list of multiple names.
+ 1
I can construe this into a oneliner but it is just bad practice.
https://code.sololearn.com/cNmGjIS5YaHN/?ref=app
+ 1
New attempt - one liner and one usage of "mean()".
https://code.sololearn.com/c5z0wDpbHrYW/?ref=app
It's just that using 'eval()' is generally considered bad practice.
0
what does return do again?