On 28/04/16 19:08, Yeh wrote: > I just solved my first question by using numpy, as below:
You need to post in plain text otherwise the mail system mangles your code, as you can see. > 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... We can't see. We don't know what the dots are, and we don't know where the return is. Most of all we don't know if you get an error, or what the error says. The more specific information you give us the more chance we have of helping you. -- Alan G Author of the Learn to Program web site http://www.alan-g.me.uk/ http://www.amazon.com/author/alan_gauld Follow my photo-blog on Flickr at: http://www.flickr.com/photos/alangauldphotos _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor