← Back to challenges

Mexican Wave Simulator

PythonHardloopsarraysstrings

Instructions

Mexican Wave Simulator

The wave (known as a Mexican wave in the English-speaking world outside North America) is an example of metachronal rhythm achieved in a packed stadium when successive groups of spectators briefly stand, yell, and raise their arms.

Create a function that takes a string and turns it into a Mexican Wave.

Examples

wave("innokodakademija") ➞ ["Innokodakademija", "Innokodakademija", "Innokodakademija", "Innokodakademija", "Innokodakademija", "Innokodakademija"]

wave("just do it") ➞ ["Just do it", "jUst do it", "juSt do it", "jusT do it", "just Do it", "just dO it", "just do It", "just do iT"]

wave(" ") ➞ []

Notes

  • All test cases will be lowercase strings.
  • Ignore spaces (they are considered empty seats).
  • An empty string should return an empty list.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.