employer cover photo
employer logo
employer logo

Samsung Cambridge Solution Centre

Aktiver Arbeitgeber

Frage im Vorstellungsgespräch bei Samsung Cambridge Solution Centre

What does this do in python [::-1]

Antwort im Vorstellungsgespräch

Anonym

21. Okt. 2025

# Reverse a string text = "hello" print(text[::-1]) # Output: "olleh" # Reverse a list numbers = [1, 2, 3, 4, 5] print(numbers[::-1]) # Output: [5, 4, 3, 2, 1] # Reverse a tuple coords = (10, 20, 30) print(coords[::-1]) # Output: (30, 20, 10)