I have a list which has the number of marks students have.
s = [50,62,15,76,57,97,82,99,45,23]
I want to grade students according to marks:
<40 - Fail
>50 - A Grade
>75 - A++ Grade
I can do this with iterating loops or I can find every list using lambda. for example :
>>> filter(lambda x:x>=50, s)
[50, 62, 76, 57, 97, 82, 99]
But, in the filter, I can work with only one function at a time (for example : marks greater than 50). Is there way where I can use filter and lambda and get required result in one line? Expecting the output as marks with grade. (ex : 50 - A, 62 - A, 76 - A++ ...)