Answers for "print string in reverse"

8

reverse string method python

#linear

def reverse(s): 
  str = "" 
  for i in s: 
    str = i + str
  return str

#splicing
'hello world'[::-1]

#reversed & join
def reverse(string): 
    string = "".join(reversed(string)) 
    return string
Posted by: Guest on January-12-2020
1

python 3 slice reverse

stringname[::-1]
Posted by: Guest on November-18-2019
0

Reverse a string

function reverseString(str) {
    return str.split('').reverse().join('');
}

reverseString('string');    // "gnirts"
Posted by: Guest on June-30-2021
-1

reverse a string

let t = s.chars().rev().collect::<String>();
Posted by: Guest on February-22-2021

Code answers related to "print string in reverse"

Code answers related to "Javascript"

Browse Popular Code Answers by Language