Nov-20-2021, 12:35 AM
i have a string in a variable x. i want to print that string in reverse order. like:
if someone wants to implement rev(), try to make sure it will reverse the order of any sequence and return the very same type it was given..
Output:>>> x = 'foobar'
>>> print(rev(x))
raboof
>>>
... assuming rev() does the job for me. but if there is no rev()], what to code? i am not interested in answers without working code. i have tried reversed() and sorted(...,reverse=True) and have not yet found a nice compact solution.if someone wants to implement rev(), try to make sure it will reverse the order of any sequence and return the very same type it was given..
Tradition is peer pressure from dead people
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.