Birgit Dulanto - 1 year ago 64

Python Question

I want to multiply

`y_list`

`>=1`

and then just print the new list (without Numpy if it is possible).

Maybe multiply

`y_list`

`i_list=[range(1,20)]`

For example:

`y_list= [1.0, 0.5669650111879195]`

`until y_list=[2.0, 1.12.. ]`

`y_list= [1.0, 0.5669650111879195]`

i=0

while all(y <= 1 for y in y_list):

i+=1

if all(y<= 1 for y in y_list):

break

print(i)

Recommended for you: Get network issues from **WhatsUp Gold**. **Not end users.**

Answer Source

If you do need to multiply it by a number (let's assume it to be `1.3`

) until all the elements are larger than one, the following is the way to go:

```
y_list = [1.0, 0.1, 0.2, 0.01]
k = 1.3
while any(y<=1 for y in y_list):
y_list = [y*k for y in y_list]
>>> print(y_list)
[112.45540695195751, 11.245540695195746, 22.491081390391493, 1.1245540695195746]
```

Recommended from our users: **Dynamic Network Monitoring from WhatsUp Gold from IPSwitch**. ** Free Download**