[ create a new paste ] login | about

Link: http://codepad.org/TNTbGmuJ    [ 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 p(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('1012'))


Output:
1
2
3
4
Traceback (most recent call last):
  Line 18, in <module>
    print(f('1012'))
NameError: name 'f' is not defined


Create a new paste based on this one


Comments: