[Tutor] Is there a library which has this object?
isaac tetteh
itetteh34 at hotmail.com
Thu Apr 28 17:19:20 EDT 2016
Im sure its not working because array is not in function. paste the error message here im sure someone will give u a better answer
Sent from my iPhone
> On Apr 28, 2016, at 4:07 PM, Yeh <yeh at whoosh.cn> wrote:
>
> Thank you!
>
>> You probably want to look at the itertools module.
>>
>> There you can find among others the count() generator function.
>> Others of possible interest include cycle() and repeat()
> Yeah, I'm going to check them now.and I just solved my first question by using numpy, as below:
> import timeimport numpy as np
> start = input("please input the value of start: ")end = input("please input the value of end: ")dur = input("please input the value of dur: ")array = np.linspace(float(start),float(end),1000)dur = float(dur)/len(array)for i in array: print(float(i)) time.sleep(dur)
> But, how to make it become a function?I tried to:def myFunction(start,end,dur):...........for i in array: return i time.sleep(dur)
> as you see, I failed...
> Thanks again!
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list