Domanda di colloquio di Apple

Reverse a string in Python without using str.reverse()

Risposte di colloquio

Anonimo

25 dic 2018

x = "Reverse a string in Python without using str.reverse()" print("".join([x[j] for j in range(len(x)-1, -1, -1)])) print(x[::-1])

1

Anonimo

6 apr 2015

string[::-1]

1