+ 1
No output
I have tried to make this code output.... racecar, stressed, and a nut for a jar of tuna. I continue to receive no output. def mystery_1(text): stack = [] for letter in text: stack.append(letter) #15 result = "" while len(stack) > 0: result += stack.pop() return result
3 Answers
+ 5
Chris ,
the code you provided should be done with the recommended indentation of *4 spaces* per level. this gives a much better readability.
> the reason why there is no output is, that the defined function is never called.
*for further posts please keep in mind, that the post should include*:
> programming language
> a clear task description with input / output sample
> a link that points to your code try
+ 3
Chris
Here is your code corrected for output which runs.
https://code.sololearn.com/cJ85afYv2n6d/?ref=app
0
How is your function implemented in your code? By output do you simply want to print the text? Then you would have to call the function using print(mystery_1(text))