Skip to main content
← CoursesPython FoundationsModule 3 · Functions and stringsTransfer: slice [::-1]predict49 / 170
💬 Discuss🧪 Playground+75 XP
Task
📝 **Task:** Predict what the program will output. ```python s = "Python" print(s[1:4]) print(s[::-1]) ``` 📋 Enter two lines and check. 💡 **Hint:** - `s[1:4]` — characters from index 1 to 3 (4 is NOT included) - `s[::-1]` — the entire line is backwards 🎯 Think: what characters does `"Python"` have in positions 1, 2, 3?

Keep going

🔮 Predict the output

Read the code carefully

s = "Python"
print(s[1:4])
print(s[::-1])

What will the program print? Write here:

📣 Help someone learn PythonShare this lesson with a friend — the first 15 are free, no signup.Tweet

💬 Discussion

Be the first to ask a question or share a tip.
Sign in to join the discussion. Reading is free.
Loading discussion…