What I want my code to do is to create an array of elements: [13.8, 13.9, 14.,...] That increase by 0.1, but each of the elements should repeat 17 times before going on to the next number. Below is my code.
from numpy import*
from pylab import*
def f(elem):
return repeat((elem + 0.1),17)
print f(13.8)
def lst(init):
yield init
while True:
next = f(init)
yield next
init = next
for i in lst(13.8):
print i
if i > 20:
break …Run Code Online (Sandbox Code Playgroud)