clean Write a function clean that when is given a string and returns the string with the leading and trailing space characters removed. Details: you must use while loop(s) you must not use the strip method • the space characters are the space , newline '\n', and tab '\t' >>> clean (" 'hello' hello ") >>> clean ("hello, how are you? ") 'hello, how are you?' >>> clean ("\n\n\t what's up, \n\n doc? \n \t") "what's up, \n\n doc?" >>> clean ("\n\n\t\ what's up, \n\n doc? \n \t")=="what's up, \n\n doc?" True
clean Write a function clean that when is given a string and returns the string with the leading and trailing space characters removed. Details: you must use while loop(s) you must not use the strip method • the space characters are the space , newline '\n', and tab '\t' >>> clean (" 'hello' hello ") >>> clean ("hello, how are you? ") 'hello, how are you?' >>> clean ("\n\n\t what's up, \n\n doc? \n \t") "what's up, \n\n doc?" >>> clean ("\n\n\t\ what's up, \n\n doc? \n \t")=="what's up, \n\n doc?" True
Related questions
Question

Transcribed Image Text:clean
Write a function clean that when is given a string and returns the string with the leading and
trailing space characters removed. Details:
you must use while loop(s)
you must not use the strip method
• the space characters are the space
, newline '\n', and tab '\t'
>>> clean ("
'hello'
hello
")
>>> clean ("hello, how are you? ")
'hello, how are you?'
>>> clean ("\n\n\t what's up, \n\n doc? \n \t")
"what's up, \n\n doc?"
>>> clean ("\n\n\t\ what's up, \n\n doc? \n \t")=="what's up, \n\n doc?"
True
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps
