Did you know SD-WANs can improve network connectivity? Check out this webinar to learn how an SD-WAN simplified, one-click tool can help you migrate and manage data in the cloud.
Become a Premium Member and unlock a new, free course in leading technologies each month.
Add your voice to the tech community where 5M+ people just like you are talking about what matters.
import math
y = [] # empty list used as empty dynamic aray
print y # to visualize what we have before
for x in xrange(100):
y.append(math.sin(x * 20))
print y # what is inside after
print '-' * 70
# The alternative approach to simulate better the array. The list
# of 100 elements is created first. Then the "normal" indexing
# can be used to access and modify the elements.
y = [0] * 100
print y # to visualize what we have before
for x in xrange(100):
y[x] = math.sin(x * 20)
print y # what is inside after
import math
import matplotlib.pyplot as plt
y = [0] * 100
for x in xrange(100):
y[x] = math.sin(x * 20)
plt.plot(y)
plt.ylabel('sin(x)')
plt.show()
If you are experiencing a similar issue, please ask a related question
Join the community of 500,000 technology professionals and ask your questions.