Flip a string | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Flip a string

Reversing a string is a common task during coding interviews. Given a string as input, output its reverse. Sample Input hello world Sample Output dlrow olleh

10th May 2021, 8:24 PM
preethiya balakrishnan
preethiya balakrishnan - avatar
5 Answers
+ 2
looks like you are using an hard coded string, you need to use input() instead so the tests can try multiple inputs
10th May 2021, 8:38 PM
Apollo-Roboto
Apollo-Roboto - avatar
+ 1
#your code goes here a="this is awesome" print(a[::-1]) This only shows testcase 1 as correct How can I print all other test case?
10th May 2021, 8:28 PM
preethiya balakrishnan
preethiya balakrishnan - avatar
+ 1
Thank you It worked👍🏻
10th May 2021, 8:40 PM
preethiya balakrishnan
preethiya balakrishnan - avatar
0
show your attemps so we can help you out!
10th May 2021, 8:24 PM
Apollo-Roboto
Apollo-Roboto - avatar
0
preethiya balakrishnan Why did you write Hard Code value, why didn't take input? Do this: a = input() print (a[::-1])
11th May 2021, 1:53 AM
A͢J
A͢J - avatar