Back to Lesson

Standardizing Input

Use a list comprehension to format a list of user inputs.

Instructions

  • Given
    names = [" alice", "BOB  ", "  charlie "]
    .
  • Use a list comprehension to strip spaces and convert to title case
    .title()
    for each string.
  • Print the resulting list.
main.py
main.py