Reverse Words In A String
A function to reverse the words in a string (using a temporary list)
Size 1 kB - File type text/python-sourceFile contents
#
#Comp 171 Standard Python Script Header
#Assignment name: Help with Stringing Along
#LUC id and Name: whonig@luc.edu Dr. William L. Honig
#Date 12 Feb 12
#
#Reverse words in a string by converting to a list
#
#Questions: None
#
def reverseMe(aString):
aList = aString.split()
aList.reverse()
bString = " ".join(aList)
return( bString )
Click here to get the file