Converting Between camelCase and snake_case

easy
Unit 3 · Strings III0/3 to milestone

Implement:

  • to_snake(name): "parseHTTPResponse" → "parse_http_response", "userID" → "user_id", "Version2Beta" → "version2_beta"
  • to_camel(name): "parse_http_response" → "parseHttpResponse" (leading underscores are preserved, repeated underscores collapse)
  • to_pascal(name): from snake_case, e.g. "user_id" → "UserId"

Acronyms in camelCase are treated as one word: a run of capitals followed by a lowercase letter splits before the last capital.

#strings#regex2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Converting Between camelCase and snake_case · TechGradify