Member Avatar for I_m_rude
t=input()
while t>0:
    t=t-1
    m,n=input().split(" ")
    m=int(m)
    n=int(n)
    m=m%10
    n=n%4
    if n==1:
        print (m)
    elif n==2:
        print (m*m)%10
    elif n==3:
        print (m*m*m)%10
    else:
        print (m*m*m*m)%10

why this code is giving me NZEC error ? it is irritating me now. thanks

Use raw_input in Python2

Member Avatar for I_m_rude

yes, i have already used that. again giving me NZEC. this is my first code in python :'(

I do not know how you produze non-zero exit code as you have not exit statemen in your code. Works for me.

for count in range(int(raw_input('Number of inputs: '))):
    m, n = raw_input('Pair of integers separated with space: ').split(" ")
    m, n = int(m) % 10 , int(n) % 4
    #print (m, n or 4)
    print pow(m, n or 4, 10)
Member Avatar for I_m_rude

I think the NZEC is coming when input is very large. Can you tell why ?
secondly, Is there any limit on the python? Actually, I started learning python because there is no limit on data type and no limit of range. :'(

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.