Practice String Indexing and Slicing - 7.2 | Strings in Python | Python Programming Language
Students

Academic Programs

AI-powered learning for grades 8-12, aligned with major curricula

Professional

Professional Courses

Industry-relevant training in Business, Technology, and Design

Games

Interactive Games

Fun games to boost memory, math, typing, and English skills

String Indexing and Slicing

7.2 - String Indexing and Slicing

Enroll to start learning

You’ve not yet enrolled in this course. Please enroll for free to listen to audio lessons, classroom podcasts and take practice test.

Learning

Practice Questions

Test your understanding with targeted questions

Question 1 Easy

What character is at index 2 in the string 'Python'?

💡 Hint: Consider the third position in the string.

Question 2 Easy

Use slicing to retrieve 'Pro' from 'Programming'. What is the code?

💡 Hint: You can use the start index to slice.

4 more questions available

Interactive Quizzes

Quick quizzes to reinforce your learning

Question 1

What is the output of text[-1] if text = 'Hello'?

H
e
o
l

💡 Hint: Think about counting from the end of the string.

Question 2

Using slicing, what will text[1:5] return in the string 'Python'?

Pyth
ytho
ytho
ython

💡 Hint: Identify the start and stop indices.

1 more question available

Challenge Problems

Push your limits with advanced challenges

Challenge 1 Hard

Given the string 'Artificial', how would you use slicing to get the substring 'ific'?

💡 Hint: Identify the starting and stopping point.

Challenge 2 Hard

Using a given string, how to retrieve character 'e' from 'Programming'?

💡 Hint: Count from zero for indices.

Get performance evaluation

Reference links

Supplementary resources to enhance your learning experience.