Jan-21-2021, 09:10 PM
Hello, this is actually a follow-up question on my code. So I actually forgot to put my code inside of a function at the start, so I added it in and its saying that its not giving the same output I had before.
string = input("Enter a string: \n") def trim(string): newstring = "" pos = 0 length = len(string) while (pos < length ): if (string[pos].isspace() != True ): newstring = newstring + string[ pos] pos += 1 print(trim(""))