0

Extra terrestrials Python solution

Can anyone tell me what is wrong with this code? String reverse does not have any effect. def greeting(): print ("hello") print (greeting()[::-1])

26th Mar 2020, 4:54 PM
James Johnson
6 ответов
+ 3
HonFu for the test cases do I need to get them all to work at the same time or seperate. also test cases 3-5 are hidden for some reason
26th Mar 2020, 6:43 PM
James Johnson
+ 2
You need to return the string instead of printing it in the function.
26th Mar 2020, 4:56 PM
HonFu
HonFu - avatar
+ 2
# try: def greeting(): return "hello" print(greeting()[::-1])
26th Mar 2020, 4:56 PM
visph
visph - avatar
+ 1
The description says you are supposed to take input once and run your code on it. Imagine someone's sitting at the other end, running your code, entering different inputs. If you set it up like that, it should work.
26th Mar 2020, 6:51 PM
HonFu
HonFu - avatar
+ 1
string = input() i = len(string) - 1 while i >= 0: i = i - 1 print(string[i+1], end='') Maybe this would help.
30th Apr 2020, 6:12 AM
Epsilon ︻╦̵̵͇̿̿̿̿╤──
Epsilon ︻╦̵̵͇̿̿̿̿╤── - avatar
0
ill advice that you take Epsilon ︻╦̵̵͇̿̿̿̿╤── idea
22nd Jul 2020, 10:27 PM
Timi Toba
Timi Toba - avatar