Hello everyone, I’m in this exercise https://www.codecademy.com/paths/analyze-data-with-python/tracks/ida-3-introduction-to-numpy/modules/ida-3-1-numpy-syntax/lessons/numpy-introduction/exercises/numpy-arrays of Numpy. And I was experimenting with the code. I tried this :
import numpy as np my_list = [1, 2, 3, 4, 5, 6,9.45,'foo'] my_array = np.array(my_list) print(my_array)
If you remove the string, then all the elements become a floating-point number, and with the string, the elements change into a string. But the lesson mentioned that arrays can be of any type. But Numpy makes sure that everything is of the same type. In general, aren’t arrays supposed to be of the same type ?? And I’m also confused between a list and an array.