5th Jun 2020, 3:54 PM
Mohammad Ansah Kuriyodath
Mohammad Ansah Kuriyodath - avatar
3 ответов
+ 1
"m" is created inside your evaluate() function. This means that it can only be "seen" inside that function. (In more technical language, it has "local scope".) To get m to be visible outside the function, you can return its value at the end of it. def evaluate(x,y): for i in range(len(y)): if x[i]==y[i]: a=a.append(i) i +=1 elif x[i]== "0": c=c.append(i) i +=1 elif x[i]!=y[i]: b=b.append(i) i +=1 m=len(a)*4 return m m = evaluate(x, y) print(m)
5th Jun 2020, 4:00 PM
Russ
Russ - avatar
0
Thank you....!!
7th Jun 2020, 8:22 AM
Mohammad Ansah Kuriyodath
Mohammad Ansah Kuriyodath - avatar