Q1

Loops, loops, and more loops.

A

Write a loop that prints out the elements of example_list.


In [ ]:
import numpy as np
np.random.seed(895437)

example_list = np.random.randint(100, size = 50).tolist()

### BEGIN SOLUTION

### END SOLUTION

B

Write a loop that prints out the indices of example_list.


In [ ]:
import numpy as np
np.random.seed(958392)

example_list = np.random.randint(100, size = 50).tolist()

### BEGIN SOLUTION

### END SOLUTION

C

Write a loop that starts at the beginning of example_list and prints out the elements of the list until it gets to an element that is less than 10.


In [ ]:
import numpy as np
np.random.seed(12857)

example_list = np.random.randint(100, size = 50).tolist()

### BEGIN SOLUTION

### END SOLUTION

D

Write a loop that starts at the beginning of example_list and prints out one number: the index of the first number bigger than 90.


In [ ]:
import numpy as np
np.random.seed(2382869)

example_list = np.random.randint(100, size = 50).tolist()

### BEGIN SOLUTION

### END SOLUTION