Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
i wish import math had an average function
why you add 1?
thanks
class_points
does not includeyour_points
, so its length is the number of every other person in the class, which is why it does weirdly still makes sense to add exactly1
more for the calculation, even though it won't change the calculation...I think this solution is incorrect logically. The len function returns the length of the list meaning if there are 8 elements in the list, the len function returns 8. so adding 1 to it increases the length to 9 which is logically incorrect for the calculation of average with 8 elelment.
My view though
You run the risk of an error without it.
It was actually my solution, but then I read in the discussion that you don't have to add your points. However my mistake was in wrong placement of ">" :/
I too was going to add .strip() to my code to take the spaces off the ends. However when I tested with just .join() it passed so I left it out
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
I was going for this but couldn't figure out how to use the strip in the same line.
End up adding a second line with: return words.strip('')
:-(
It is needed to add own score as there is a possiblity that you get an empty list (you alone wrote the test). This would result in division by zero.
If you want to use sorted for shortness at least save 'sorted(arr)' in a variable instead to sort two times the same array.
I wanted to ask why it's redundant, because I thought that you are part of the class so your_score affects average score (which is true).
But when I was writing this comment I realized that although your score affects average it won't affect the overall answer for the question: "Is your_score higher then average in this class?".
The reason for this is that if including your_score in the average calculations increases average then your score was already higher then average so result won't change. The same happens if your score decreases average.
Maybe someone will find this explanation usefull so I'm leaving it here.
Best practices but... the test cases dont have trailing or leading whitespace
Loading more items...