why this code is giving runtime error(nzec) in python… plese help!!
import math
test = input()
while test>0:
n=input()
if n==0:
print '0'
else:
j = int(math.log(n,2))
print int(pow(2,j))
test-=1
why this code is giving runtime error(nzec) in python… plese help!!
import math
test = input()
while test>0:
n=input()
if n==0:
print '0'
else:
j = int(math.log(n,2))
print int(pow(2,j))
test-=1
Could you specify which question this is? i think you should try and replace input() by int(raw_input().strip())
Can you provide the problem link ? It’s working fine for me.
Check here : http://ideone.com/FoIrAF
@kcahdog
thnks it workd for me, its a peer question DCE05 Problem - CodeChef
i dont know why it was not working for input()
^Due to unexpected whitespaces in i/p.