On Mon, Sep 11, 2017 at 11:29 AM, Rick Johnson <rantingrickjohn...@gmail.com> wrote: > Ruby: > farray = [1.5, 1.9, 2.0, 1.0] > uniqueIntegers = farray.map{|f| f.to_i()}.uniq.length > > Python: > flist = [1.5, 1.9, 2.0, 1.0] > uniqueIntegers = len(set(map(lambda f:int(f), flist)))
Python: floats = [1.5, 1.9, 2.0, 1.0] unique_integers = len(set(int(f) for f in floats)) or: unique_integers = len(set(map(int, floats)) If you're going to use Python, at least use it right. ChrisA -- https://mail.python.org/mailman/listinfo/python-list