Feed on

let’s say you want to make an array of all the numbers between 5 and 7, separated by the interval 0.33 in python. one way to do that would be:

min = 5.0

max = 7.0

interval = 0.33

my_list = [min + val*interval for val in range(int((max-min)/interval))]

Bookmark and Share

if that was helpful ...

check out the other tips and tricks i've compiled on these pages. you might learn something else interesting!

Did I get this wrong? Let me know!

Trackback URI | Comments RSS