Problem 161542 · easy · Level 01 Prerequisites & Setup

Mocking Text

strings · iteration · indexing · upper · lower

Write the meme style where letters alternate case. Given a string s, return a copy where characters at even positions (0, 2, 4, ...) are uppercase and characters at odd positions are lowercase. Positions are counted over all characters, including spaces and punctuation, which are left as they are.

Examples

Input:  s = "hello world"
Output: "HeLlO WoRlD"

Input:  s = "PYTHON"
Output: "PyThOn"

Constraints

  • 0 <= len(s) <= 2000
  • s may contain letters, digits, spaces and punctuation

Goals

  • Use `enumerate` or `range(len(s))` to know the position of each character
  • Apply `upper` and `lower` selectively
  • Build a string piece by piece
Starting Python…