Create a variable called y which is an evenly distributed array from 0 to 2.
Then, perform the following:
Print the array.
Print the values at index 0 and index -1.
Use np.sqrt to take the square root of the whole array.
If you get stuck on syntax, use the internet! Don't forget to import NumPy correctly.
Run the code below and observe the output.
Type your answer in the text box below the code to explain why the result is different between the two operations.
import numpy as np
# initalize 2 Python lists
list1 = [1,2,3]
list2 = [4,5,6]
# initialize 2 NumPy arrays using the same values
array1 = np.array([1,2,3])
array2 = np.array([4,5,6])
# print the result of adding the two sequences
print(f"Python Lists [1,2,3]+[4,5,6] = {list1+list2}")
print()
print(f"NumPy Arrays [1,2,3]+[4,5,6] = {array1+array2}")
print()
print()
# print the result of multiplying the first sequence times 3
print(f"Python Lists [1,2,3]*3 = {list1*3}")
print()
print(f"NumPy Arrays [1,2,3]*3 = {array1*3}")
Before you submit, please make sure that your share settings are set so that anyone with the link is can comment on your notebook! Thank you!!