Exercise · Strings · lesson 11 of 12
Exercise: reverse a string
Write a function function reverse(s) that returns a new string made of the characters of the string s in reverse order.
reverse("hello")→"olleh"reverse("привет")→"тевирп"reverse("ab cd")→"dc ba"
Constraints: s has 0 to 100 characters — Latin and Russian letters, digits and spaces; there are no emoji or other characters that take two places in a string. For the empty string "" the result is the empty string "".
Do not add extra imports unless the task says so explicitly.
Subscribe to take the course
The course is free. Sign in with Telegram and subscribe to the channel to open every lesson.