# Numpy is imported, seed is set # Initialize random_walk random_walk = [0] # Complete the ___ for x in range(100) : # Set step: last element in random_walk step = random_walk[-1] # Roll the dice dice = np.random.randint(1,7) # Determine next step if dice <= 2: step = step - 1 elif dice <= 5: step = step + 1 else: step = step + np.random.randint(1,7) # append next_step to random_walk random_walk.append(step) # Print random_walk print(random_walk) #Not Going below zero # Numpy is imported, seed is set # Initialize random_walk random_walk = [0] for x in range(100) : step = random_walk[-1] dice = np.random.randint(1,7) if dice <= 2: # Replace below: use max to make sure step can't go below 0 step = max(0, step - 1) elif dice <= 5: step = step + 1 else: step = step + np.random.randint(1,7) random_walk.append(step) print(random_walk)