nearest-value checking error
I would like to give some feedback about ...
From: https://py.checkio.org/mission/nearest-value/solve/
HTTP_USER_AGENT: The question provided the variable should be set as `def nearest_value(values: set, one: int)`, however, I provided my answer that run correct, by clicking Check it shows AttributeError: 'list' object has no attribute 'add'.<br> I believe there should bu something wrong here.
def nearest_value(values: set, one: int) -> int: if one in values: return one else: values.add(one) a = list(values) a.sort() p = a.index(one) if p == len(a)-1: return a[p-1] else: return a[p+1] if one-a[p-1] > a[p+1]-one or p==0 else a[p-1] Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36