Using greater than operator to Compare corresponding integers of a 2 lists

Viewed 32

i have a list with Maximum Scores, and another list with the current score something like this

max_scr = [400,100,2,19,15,15]

currnt_scr = [375,46,1,10,4,6]

i would like to make a new list containing only the values of currnt_scr that are greater than 50% of max_score so the result should be :

new_list = [46,4,6]

what i am trying to do is to know which elements have passed the halfway mark in current score list as well as a new list with these elements

this is the best i could think of which doesn't work since < operation is not supported between Int and List Thank You In Advance

max_scr  = [400,100,2,20,15,16]

max_scr_in_half = [200,50,1,10,8,8] # to represent the halfway mark

currnt_scr = [375,46,1,10,4,6]

new_list = [item for item in currnt_scr if item < max_scr_in_half] ```

1 Answers

You can use zip() function.

new_list = [i for i, j in zip(currnt_scr, max_scr_in_half) if i < j]
Related