2011-04-12, 11:20 PM
Use [noparse]
Or you could use some Python-fu and do this:
@JPTheMonkey
Do:
sent.split(" ")
Alternatively:
Code:
, not [quote][/noparse] when inputting code.
[quote=Alley]So, basically I have to return a string backwards. So if I input "Cookies are freaking good.", it has to return, ".doog gnikaerf era seikooC".
Here's what I think has to be done, but it isn't working.[/QUOTE]
[code]
def backwards_word(words):
index = 0
while index <= len(words):
letter = words[index]
print letter
index -= 0 #Did you mean += 1 here? -= 0 doesn't change the index at all
words = raw_input("Word: ")
backwards_word(words)Or you could use some Python-fu and do this:
Code:
inputString = "Cookies are freaking good."
inputString = inputString[::-1]
print(inputString)@JPTheMonkey
Do:
sent.split(" ")
Alternatively:
Code:
import re
sent = raw_input("Enter the sentence you would like to have translated: ")
words = re.findall("\w+", sent)
print(words)