Display Random values in Python [Jupyter]

Display random values and ignore negative values , display negitive values as a 0

import numpy as np
#Draw 25 random numbers from -1 to 1
my_data = np.random.uniform(-1, 1, 25)

#if number less then 0 or -ive value , the number display as a 0
for index, number in enumerate(my_data):
if number < 0:
my_data[index] = 0

print(my_data)

Leave a comment