algorithmic modeling for Rhino
Not an answer to your first question but if you're trying to get the length of the list try len(x)
Make sure to right click on x input and change the access to List Access
Thanks Mostapha, I want to get the most common element in the list, which in this case would be 8. I think with the len() function I would get the lenght of the list.
You can use Python's collections module for that. Try this:
from collections import Counter
testList = [1,2,4,5,5,6,7,8,8,8,8,8,8]mostOccurred,numOfOccurance = Counter(testList).most_common(1)[0]
print "%d and for %d times" % (mostOccurred, numOfOccurance)
Similar question on stackoverflow: http://stackoverflow.com/questions/6987285/python-find-the-item-wit...
One of my personal favorites that one :)
This is exactly what i was looking for. Thanks again
I owe my life
Welcome to
Grasshopper
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
Added by Parametric House 0 Comments 0 Likes
© 2024 Created by Scott Davidson. Powered by