Skip to content
Chapter Practice Arena

Strings and Text Problems

Targeted practice challenges specifically curated for this chapter. Inspect hints, verify outputs, and check Pythonic solutions.

All Chapters
Difficulty:
Chapter:
Showing 6 challenges · 18 total · Page 1 of 3
#1intermediateString Splitting and Joining
Split 'A,,C,' using a comma separator and print the resulting list. The empty fields must be preserved.
Starter Code
record = 'A,,C,'
# Split the record and print the list
Expected Output:['A', '', 'C', '']
Split the string 'one two' on whitespace and print the resulting list. The output must be ['one', 'two'].
Starter Code
text = 'one two'
# Split the text and print the list
Expected Output:['one', 'two']
Given the string word = 'coding', print its first three characters using slicing. The expected output is cod.
Starter Code
word = 'coding'
# Print the first three characters
Expected Output:cod
#4intermediateString Splitting and Joining
Given numbers = [10, 20, 30], print exactly 10, 20, 30 using join(). Convert each number to a string before joining.
Starter Code
numbers = [10, 20, 30]
# Convert the numbers and join them
Expected Output:10, 20, 30
Given parts = ['learn', 'by', 'doing'], print learn-by-doing using join().
Starter Code
parts = ['learn', 'by', 'doing']
# Join the strings with hyphens
Expected Output:learn-by-doing
#6beginnerString Methods
Given text = 'Learn Python', print whether it starts with 'Learn', then print the index where 'Python' begins.
Starter Code
text = 'Learn Python'
# Check the prefix and find the substring
Expected Output:True 6