vendredi 16 mars 2018

unable to read IF in printing outputs

For the following code, Python recommended me to use a.any. Now, according to my code what the outputs show is wrong. l is bigger than 1 but the out put is printing r instead of q=10.

from numpy import *
import numpy as np

for i in range (1,3):
    r=np.random.uniform(0,3,i)
    x=np.random.uniform(0,9,i)    
    h=np.random.uniform(0,1,i)
    l=r+x
    if (l<1.0).any:
        q=r
    elif (l>1.0).any:
        q=10
    print("q= ",q,"l= ",l)




Aucun commentaire:

Enregistrer un commentaire