10 Telephone: Randomly mutating strings
“What we have here is a failure to communicate.”
Now that we’ve played with randomness, let’s apply the idea to randomly mutating a string. This is interesting, because strings are actually immutable in Python. We’ll have to figure out a way around that.
To explore these ideas, we’ll write a version of the game of Telephone where a secret message is whispered through a line or circle of people. Each time the message is transmitted, it’s usually changed in some unpredictable way. The last person to receive the message will say it out loud to compare it to the original message. Often the results are nonsensical and possibly comical.
We will write a program called telephone.py that will ...