algorithmic modeling for Rhino
Hi,
I am trying to get the smallest value of a list. I know I could do a for loop for this but I want to use the python built in function min(). It gives me an error "Runtime error (ArgumentTypeException): float is not callable!"
This is the code I am running.
print min(3,4,3,6,67,78,7)
If I use the max() function it works fine. Any ideas of why this is not working?
Thanks,
M
Tags:
You should pass a list to min.
Try this:
print min([3,4,3,6,67,78,7])
http://docs.python.org/2/library/functions.html#min
min and max expect iterables (lists, tuples, arrays,...) Place brackets or extra parentheses around your numbers to turn them into lists or tuples.
print min ( [3,4,5,6,67,78,7] )
Thanks Steve and Mostapha.
M
I should have said iterables. Thanks Steve.
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
© 2024 Created by Scott Davidson. Powered by