Frage im Vorstellungsgespräch bei Apple

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

Antworten zu Vorstellungsgespräch

Anonym

6. Apr. 2015

string[::-1]

1

Anonym

25. Dez. 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