employer cover photo
employer logo
employer logo

Samsung Cambridge Solution Centre

Employeur impliqué

Question d’entretien chez Samsung Cambridge Solution Centre

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

Réponse à la question d'entretien

Utilisateur anonyme

21 oct. 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)