On 25/02/17 17:12, Rafael Knuth wrote:
> I want to compare two strings and count the number of identical letters:
>
> stringB = "ABCD"
> stringA = "AABBCCDDEE"
> for b in stringB:
> if b in stringA:
> r = 0
> r += 1
> print (r)
>
> How do I count the output (r) instead
I want to compare two strings and count the number of identical letters:
stringB = "ABCD"
stringA = "AABBCCDDEE"
for b in stringB:
if b in stringA:
r = 0
r += 1
print (r)
How do I count the output (r) instead of printing it out?
(result should be 4). Thanks!
__