mardi 7 avril 2020

Find the mean of array1 scores when array2 has scored less than 10

>>> ravi = np.arange(1,13).reshape(3,4)
>>> sai = np.random.randint(1,50,12).reshape(3,4)
>>> print(ravi)
>>> print(sai)

ravi= [[ 1  2  3  4]
       [ 5  6  7  8]
       [ 9 10 11 12]]

sai = [[40  3  7 31]
       [15 16 30 20]
       [28  1 27  5]] 

for question 2 I've tried

scorer =  np.maximum(ravi,sai)
  1. Consider the array values are the scores. Now I want to find the mean of 'ravi' score when 'sai' has scored less than 10.

  2. Compare ravi and sai score in each match(here each element) and print the name of the player who has a high score in each match. Scorer gives each match score in the array instead I want their name should be printed.




Aucun commentaire:

Enregistrer un commentaire