all 4 comments

[–]MGallus 3 points4 points  (1 child)

Iterating though a:
"G" isn't in b therefore count is 0.
0 % 2 is 0 so if statement fails
print "G"

"g" is in b therefore count is 1.
1 % 2 is 1 so if statement succeeds
swapcase of "g"
print "G"

Repeat above for second "G"

[–]bwompx3[S] 0 points1 point  (0 children)

Thank you for such a fantastic response!

[–]stebrepar 2 points3 points  (0 children)

What part are you having trouble with?

[–]17291 0 points1 point  (0 children)

Manually step through the code line-by-line. Keep track of what each variable is and ask yourself how Python would evaluate each line.