Remove Whitespace (Exercise)
00:00
In this exercise, your task is to write a program that removes whitespace from the following strings. Then print out the strings with the whitespace removed. string1
is " Filet Mignon"
.
00:10 I guess these are a couple of food items, but it looks like the person who wrote the menu had some issues with putting a bit too much whitespace in different places.
00:19 So I’m making up the story around the task that you’re the programmer of this restaurant, and you’re supposed to clean up the online menu, something like that.
00:28 So you see the first string has some whitespace on the left, the second one has some whitespace on the right, and the third one has whitespace on the left and right.
00:36 So it’s a cheeseburger with some whitespace bun.
00:40 One thing, though, that’s useful for you before you start this task, you can use these slides and actually just copy what’s in there, right? So I’m going to go ahead and copy this
00:51 because it’ll make it easier for me than typing out these whitespaces, even though it doesn’t matter how many there are.
Become a Member to join the conversation.