1.1. Exercises
NumPy and Array Questions
array([ 0, 5, 10, 15, 20, 25, 30])More NumPy
NumPy Practice
Instructions:
Running a coding exercise for the first time could take a bit of time for everything to load. Be patient, it could take a few minutes.
When you see ____ in a coding exercise, replace it with what you assume to be the correct code. Run it and see if you obtain the desired output. Submit your code to validate if you were correct.
Make sure you remove the hash (#) symbol in the coding portions of this question. We have commented them so that the line won’t execute and you can test your code after each step.
Let’s explore how Python compares lists and arrays.
Tasks:
- Create 2 lists of the same length and save each as objects named
a_listandb_list. - Using Boolean operators, what is outputted when you test to see if they are equal?
Now let’s do the same exercises using arrays.
Tasks:
- Create 2 arrays of the same length and save each as objects named
a_arrayandb_array. - Using Boolean operators, what is outputted when you test to see if they are equal?
This is an example of how useful arrays can be when doing numerical computation! To compare each element in a list would take more code and time for the same result.