Practice Arena

Python Coding Challenges

Write real Python in the browser. Instant feedback. From beginner to expert.

819 challenges 506 easy 280 medium 33 hard
Strings & Text easy

Title case converter

Return the string with each word capitalised.

strings split
+5 pts 5m
Strings & Text easy

Longest word in a sentence

Write a function that returns the longest word from a sentence, with first-occurrence tie-breaking.

strings parsing split
+8 pts 10m
Strings & Text easy

Replace vowels with stars

Write a function that replaces every vowel in a given string with an asterisk.

strings transformation vowels
+10 pts 10m
Strings & Text easy

Normalize quotes

Replace all typographic quote characters with straight ASCII quotes.

strings replacement unicode
+10 pts 12m
Strings & Text easy

Interleave Two Strings

Given two strings s1 and s2, return a new string that interleaves them character by character, starting with s1.

strings merging loops
+8 pts 10m
Strings & Text easy

Center a string in a width

Write a function that centers a string within a specified width by adding spaces on both sides.

strings padding formatting
+8 pts 10m
Strings & Text easy

Remove Duplicates from String

Given a string, return a new string with each character that repeats consecutively reduced to a single occurrence.

strings loop filter
+8 pts 10m
Strings & Text easy

Longest Word Finder

Write a function that extracts alphabetic words from a string and returns the longest one, with ties broken by earliest position.

strings parsing max
+10 pts 10m
Strings & Text easy

Abbreviate Name

Create a function that takes a full name and returns an abbreviated version with initials and the last name.

strings formatting split
+10 pts 15m
Strings & Text easy

Replace Spaces with Dashes

Write a function that replaces every space in a string with a dash.

strings replace manipulation
+5 pts 5m
Strings & Text easy

Compress Consecutive Chars

Write a function that compresses a string by replacing runs of identical characters with the character followed by the count.

string run-length compression
+8 pts 12m
Strings & Text easy

Index of First Occurrence

Implement a function that finds the starting index of a substring within a string, returning -1 when absent.

strings search index
+8 pts 12m
Strings & Text easy

Parse Log Line

Write a function that parses a log line and returns a dictionary with timestamp, level, and message.

string-parsing split strip
+10 pts 15m
Strings & Text easy

Replace multiple spaces

Implement a function that replaces every sequence of spaces with a single space.

strings whitespace normalization
+8 pts 10m
Strings & Text easy

Extract domain from URL

Extract the domain (hostname without port or www) from a given URL string.

url parsing strings
+8 pts 12m
Strings & Text hard

Basic Calculator III

Implement a recursive descent parser to evaluate a fully parenthesized arithmetic expression with +, -, *, / and parentheses.

parsing string expression
+45 pts 40m
Strings & Text medium

Minimum Remove Valid Parentheses

Given a string with parentheses and letters, remove the fewest parentheses to make it valid.

strings stack validation
+20 pts 25m
Strings & Text easy

Parse URL components

Write parse_url that splits a URL into its standard components with defaults for missing parts.

url-parsing strings parsing
+8 pts 10m
Strings & Text medium

Parse key-value lines

Parse structured key-value lines into a dictionary with support for quoted values and escaped characters.

parsing strings dictionary
+20 pts 20m
Strings & Text easy

Decode base64 string

Write a function that decodes a base64 string to its original UTF-8 text without using the base64 module.

base64 decode strings
+8 pts 10m
Strings & Text easy

User Friendly Message

Given a raw user input, format it into a single clean sentence with proper sentence case and trimming.

strings formatting cleaning
+8 pts 12m

Showing 21 challenges · Strings & Text

Strings & Text — Python coding challenges

What you will find here

This page lists strings & text challenges — real Python problems you solve in the browser IDE with instant test feedback. Each challenge includes a clear brief, starter code, and automated checks.

Challenges vs tutorials and quizzes

Challenges test what you can build under constraints. For guided teaching, use our Python tutorials. For quick checks, try quizzes or copy snippets from code samples.