[ create a new paste ] login | about

Link: http://codepad.org/ejwXGVL9    [ raw code | output | fork ]

Python, pasted on Nov 22:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
def f(n):
    if n.endswith('0'):
        return "NO"
    else:
        x=0
        a=len(n)
        for i in range(a):
            c=int(n[i])+int(n[a-1-i])+x
            if c<10:
                if c%2==0:
                    return "NO"
            else:
                if c%2==0:
                    return "NO"
                else:
                    x=1
        return "YES"
print(f('6547'))


Output:
1
NO


Create a new paste based on this one


Comments: