Reputation: 347
def power(num,div):
incre =0
while(num%div == 0):
num = num/div
incre +=1
return incre
test_case = int(raw_input())
lim = 0
while lim < test_case:
power = (raw_input())
x = power.split()
a = int(x[0])
b = int(x[1])
lim +=1
print power(a,b)
Python used to work normally until I had this error.
Upvotes: 0
Views: 96
Reputation:
raw_input
always returns a string object. Because of that, this line:
power = (raw_input())
makes power
a string. Furthermore, when this happens, it overrides your function power
.
When you get to this point:
print power(a,b)
power
is a string and you get an error for trying to call it as you would a function.
To fix the problem, either rename the function or the string. They both can't be named power
.
Upvotes: 9