Python program to Find Highest Element in an Array

from random import random
x = 20
y = []
for i in range(x):
 y.append(random())
 print(round(y[i],2), end=' ')
print()
maximum = 0
for i in y:
 if i > maximum:
  maximum = i
print("The highest value = ", round(maximum,2))

 

 

Output:

1.0 0.18 0.09 0.83 0.28 0.26 0.34 0.35 0.52 0.22 0.46 1.0 0.2 0.34 0.13 0.81 0.52 0.37 0.22 0.74
The highest value =  1.0

 

0.85 0.52 0.8 0.49 0.16 0.96 0.25 0.14 0.62 0.52 0.46 0.86 0.19 0.22 0.03 0.76 0.6 0.99 0.38 0.7
The highest value =  0.99

Subscribe For Daily Updates

100+ Python Pattern Examplespython pattern examples - star patterns, number patterns