Challenge: String Cleaning
Building on your knowledge of string methods, you will now put your skills to the test by cleaning and standardizing raw user input. This is a common task in real-world data processing, where data often comes in messy or inconsistent formats. Your goal is to ensure that the input is tidy, consistent, and ready for further processing by applying a series of string transformations.
Swipe to start coding
Write a function that takes a string and returns a cleaned version of it. The function must:
- Remove any leading and trailing whitespace from the input string.
- Convert all characters in the string to lowercase.
- Replace all spaces in the string with underscores.
Ratkaisu
Kiitos palautteestasi!
single
Kysy tekoälyä
Kysy tekoälyä
Kysy mitä tahansa tai kokeile jotakin ehdotetuista kysymyksistä aloittaaksesi keskustelumme
Awesome!
Completion rate improved to 6.67
Challenge: String Cleaning
Pyyhkäise näyttääksesi valikon
Building on your knowledge of string methods, you will now put your skills to the test by cleaning and standardizing raw user input. This is a common task in real-world data processing, where data often comes in messy or inconsistent formats. Your goal is to ensure that the input is tidy, consistent, and ready for further processing by applying a series of string transformations.
Swipe to start coding
Write a function that takes a string and returns a cleaned version of it. The function must:
- Remove any leading and trailing whitespace from the input string.
- Convert all characters in the string to lowercase.
- Replace all spaces in the string with underscores.
Ratkaisu
Kiitos palautteestasi!
single