Generally well answered although some mixing up of reasons for large and small dx
There are marks for axis titles and labels. Use plt.title etc...
Some failed the autograder! You can check this with Kernel -> restart & run all.
Python 'range()' function:
for i in range(3):
print(i)
output: 0,1,2
for i in range(1,4):
print(i)
output: 1,2,3
for i in range(0,4,2):
print(i)
output: 0,2
Python 'range()' function:
for i in range(0,4):
if i % 2 == 0:
print(i)
output: 0,2
x = [i for i in range(5)]
print(x)
output: [0,1,2,3,4]
Ways to Create NumPy Arrays:
numpy.array()
numpy.zeros()
numpy.ones()
numpy.eye()
import numpy as np
# From Python Lists
a = np.array([1, 2, 3])
# Zeros Array
b = np.zeros((3,))
# Ones Array
c = np.ones((4,))
# Identity Matrix
d = np.eye(3)
Which one of these methods is a valid way to create a NumPy array?
numpy.arange()
numpy.linspace()
numpy.logspace()
numpy.random.rand()
They all do.
Which one of these methods is a valid way to create a NumPy array?
numpy.random.rand()
numpy.random.randint()
numpy.random.randn()
numpy.diag()
They all do.
Various ways to slice a NumPy array:
x = x[1:-1]
x = x[::2]
x = x[::-1]
x = x[1:4]
x = x[1:4, 0:2]
import numpy as np
x = np.array([0, 1, 2, 3, 4, 5])
# Remove first and last element
y = x[1:-1]
# Select every other element
z = x[::2]
# Reverse the array
w = x[::-1]
# Select a subarray
v = x[1:4]