0

How do you make a code that will take an input word and output it backwards?

27th Sep 2017, 12:45 AM
Billy Bob
Billy Bob - avatar
2 Answers
+ 1
Ace's solution is the most concise one, and thus preferred by experts. For a beginner, splitting the tasks would probably be easier to understand: string = input("Enter a string to be reversed:\n") reverse_string = (string[::-1]) print("Reverse string: ", reverse_string) Semantically, the both codes are identical. The only difference is in comprehensibility for a learner.
27th Sep 2017, 6:14 AM
Jussi Rosti
Jussi Rosti - avatar