• Python question of the day

    What would be the output of executing the following code:
    import numpy as np
    print(np.array((3, 4, 10.0, 4)))
     [ 3. 4. 10.]
     [ 3. 4. 10. 4.]
     [ 3 4 10 4]
     [ 3 4 10]
    Explanation:
    If one or more elements in ndarray is float and others are integers, numpy will convert all to floats as numpy array, in general, is homogeneous (there is a particular record array type that is heterogeneous)


    Top 100 python interview questions:






datai analytics