Solve in Python:
# One is the loneliest number

## Task

The range of vision of a digit is its own value. `1` can see one digit to the left and one digit to the right,` 2` can see two digits, and so on.

Thus, the loneliness of a digit `N` is the sum of the digits which it can see.

Given a non-negative integer, your funtion must determine if there's at least one digit `1` in this integer such that its loneliness value is minimal.

## Example

```
number = 34315
```

digit | can see on the left | can see on the right | loneliness
--- | --- | --- | ---
3 | - | 431 | 4 + 3 + 1 = 8
4 | 3 | 315 | 3 + 3 + 1 + 5 = 12
3 | 34 | 15 | 3 + 4 + 1 + 5 = 13
1 | 3 | 5 | 3 + 5 = 8
5 | 3431 | - | 3 + 4 + 3 + 1 = 11

Is there a `1` for which the loneliness is minimal? Yes.
def loneliest(number):
    if (str(number)).count("1")==0:
        return False
    if (str(number)).count("1")==len(str(number)):
        return True
        
    number=[int(a) for a in str(number)]
    score=[]
    one=[]
    for idx,nr in enumerate(number):
    
        b = idx-nr
        f = idx+nr+1
        s=0
        
        if b<0: b=0
        if f>len(number): f=len(number)
    
        s+=sum(number[b:idx])
        s+=sum(number[idx+1:f])
        
        if nr==1: one.append(s)
        else: score.append(s)

    score.sort()
    one.sort()
    if score[0]>=one[0]:
        return True
    return False