Skip to content
CodeItRaw
Code Reading
/
Reverse the Words
Path
Play
Daily
Leaderboard
tr
Bug Hunt
Reverse the Words
It should turn "a b c" into "c b a", but it gives the sentence back unchanged. Find the line and the kind of bug.
Click the line you think is wrong.
1
def
reverse_words
(text):
2
stack = []
3
for
word
in
text.split():
4
stack.append(word)
5
out = []
6
while
stack:
7
out.append(stack.pop(
0
))
8
return
" "
.join(out)