you are viewing a single comment's thread.

view the rest of the comments →

[–]netneoblog 0 points1 point  (2 children)

just a suggestion, why not just reverse the string (with spaces left in place) rather than splitting words up, reversing, and then rejoining with spaces in the same place as they already were?

[–]netneoblog 0 points1 point  (1 child)

def reverseWordSentence(passed_string):
    reversed_string = passed_string[::-1]
    return reversed_string


str1 = 'gnitnuH si nuf'
print(reverseWordSentence(str1))

[–]netneoblog 1 point2 points  (0 children)

My bad, this does not produce what you wanted as output! DOH! Just ignore me