hi, if you want to do it absolutely in one line, maybe something like
getCentroid = lambda inputs : [sum([a[x] for a in inputs]) / float(len(inputs)) for x in range(3)] if len(inputs) else None ? Then you can use getCentroid([[1, 0, 0], [0, 1, 0], [-1, 0, 0]]) for example. But why doing it in one line, it becomes a bit complicated if other people have to read your code. Le jeudi 24 novembre 2016 10:49:47 UTC-8, [email protected] a écrit : > > hello, this should be a simple one i guess, i have this so far: > > avrg_coords=[sum(x) for x in zip (*coord_list)] > > but i need to be able to divide the result by len(coord_list) to find the > average. Is there a way i can add this into this line, or would i have to > do this seperately? maybe there is alternate way to average lists of > tuples? > > > thanks, > Sam -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/638abf85-9298-452e-b692-5637bf417e07%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
