That’s because in your second code you’re re-assigning r
back to the empty string ''
. Thus you only get the final character multiplied 3 times (which for Mississippi is i
).
solved Why am I getting two diferent outputs with my python code? [closed]