0

How do I input data for code coach?

I was working on the Pig Latin problem in Python, but I’m not sure how to input a sentence. I have tried: inputSentence = str(input()) but it doesn’t work. Any help is appreciated, thanks.

31st Mar 2020, 3:23 PM
Reynold Chia
Reynold Chia - avatar
5 Antworten
+ 3
You don't need to convert input to string <<inputSentence = str(input())>>, as input always returns data in string format. But i am not sure if this is your issue. As we only can see this single line of code, we can give no help at the moment.
31st Mar 2020, 5:14 PM
Lothar
Lothar - avatar
+ 3
A closing parenthesis at the end of the last line with print ... is missing.
1st Apr 2020, 11:08 AM
Lothar
Lothar - avatar
+ 2
In each task is an example of input. Then this must be read accordingly.
31st Mar 2020, 4:38 PM
JaScript
JaScript - avatar
+ 2
Thanks!
1st Apr 2020, 12:19 PM
Reynold Chia
Reynold Chia - avatar
0
hi Ja Play I have removed the str() function and it still does not work. The following is my code: inputSentence = input() resultSentence = [] for word in inputSentence.split(): piggedWord = word[1:] + word[0] + 'ay' resultSentence.append(piggedWord) print(' '.join(resultSentence) What is the issue?
1st Apr 2020, 9:56 AM
Reynold Chia
Reynold Chia - avatar