Vote count:
0
I am trying to make a function which will read the first 4 character of two strings and increment the counter K if they are identical.
ying = ('SamSAMAN')
yang = ('sasaban')
k = 0
j = 4
while k<j :
if [ying[k].lower()] == [yang[k].lower()] :
k+=1
print (k)`
when i run the code above, it s not showing any error but its also not printing the value of K (which i intended to be 2, based on ying and yang)
I am not sure where i am doing this wrong. any alternatives ?
asked 20 secs ago
Increment in global variable in Python
Aucun commentaire:
Enregistrer un commentaire