Well, you have some syntax errors in your code. I'll try to list them.
1 - To declare a variable of type string just do:
nomeVariavel = "conteúdo da string"
2nd - Your function is not receiving any parameters. The function must receive parameters, which will be the values used within the function.
Ex.:
def quantosIguais(a, b):
3 - The variant and , which will be used as a counter, must be declared within the scope of the function.
4º - To find the string size, it is done len(nomeString)
and not (len)nomeString
.
5º - In the for loops you used, they cover only 1 value, which is the letter you put. To use the variable, simply place the variable name after in
. Using the quotation marks, you go through a new string, different from the string stored in the variable.
Make:
for a in nomeString
instead of:
for a in 'nomeString'
Well, I've tried listing the syntax errors, but as has been said, your code does not make sense. I would also like to understand what your logic was to get to that code.
I'll leave an example of a function that does what you tried to do:
def quantasIguais(strA, strB):
e = 0
for i in range(len(strA)):
if strA[i] == strB[i]:
e += 1
return e