I want this code to multiply this list until all numbers exceeds 100, but I am struggling in the loop part.
import numpy as np
a = np.array([230, 10, 284, 39, 76])
def all_30_or_up(ls):
for i in ls:
if i < 100:
return False
return True
while True:
if all_30_or_up(a) == False:
print(a*2)
else:
break
This exercise is from the book "How to Think Like a Computer Scientist: Learning with Python 3". That's the actual question in the book:
"Use a mask to multiply all values below 100 in the following list by 2:
a = np.array([230, 10, 284, 39, 76])
Repeat this until all values are above 100. (Not manually, but by looping) Then, select all values between 150 < a < 200."