Practice Arena

Python Coding Challenges

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

467 challenges 330 easy 120 medium 17 hard
Strings & Text easy

Camel case to snake case

Write a function that converts camelCase input to snake_case while handling acronyms and numbers correctly.

strings case-conversion parsing
+10 pts 15m
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

Extract Digits Only

Given a string that may contain letters, symbols, and whitespace, extract all digits in order and return them as an integer.

strings digits parsing
+5 pts 5m
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

Extract digits from string

Write a function that extracts all digit characters from a given string, preserving their original order.

strings digits parsing
+6 pts 8m
Strings & Text easy

Kebab Case Converter

Implement a function that converts any string to kebab-case, handling spaces, underscores, camelCase, and punctuation.

strings case-conversion parsing
+8 pts 15m
Strings & Text easy

Expand compressed string

Implement a function that expands run-length encoded strings (e.g., 'a3b2' → 'aaabb').

strings parsing run-length-encoding
+10 pts 15m
Strings & Text easy

Roman to Integer

Convert a valid Roman numeral string to an integer using standard rules.

roman string integer
+10 pts 15m
Strings & Text easy

Safe Command Executor

Implement emulate_run that simulates running a command list and returns output and exit code.

string-parsing simulation lists
+8 pts 10m
Strings & Text easy

Stack Trace Sanitizer

Implement a function that rewrites traceback file paths to basenames only.

strings regex parsing
+8 pts 12m
Strings & Text easy

Extract Hashtags

Extract unique hashtags from a given text string in the order they appear.

strings parsing hashtags
+10 pts 15m
Strings & Text easy

Extract mentions

Extract unique @mentions from a string, respecting email-like patterns and punctuation.

strings parsing sets
+10 pts 15m
Strings & Text easy

Validate time format

Check whether a given string is a valid 24-hour time in HH:MM format.

strings validation time
+10 pts 15m
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

Remove HTML tags

Remove all HTML tags from a string to extract clean text.

html string parsing
+10 pts 15m
Strings & Text easy

Extract Quoted Strings

Write a function that extracts the text inside every double-quoted substring from a given string.

strings parsing quotes
+8 pts 12m
Strings & Text easy

Split on camelCase

Given a camelCase string, split it into words at uppercase letters and return them as lowercase words.

strings parsing camelcase
+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 easy

Parse key=value pairs

Implement a parser that converts a space-separated 'key=value' string into a Python dictionary, supporting quoted values.

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

Find all numbers in text

Write a function that extracts all standalone integers from a text string using regular expressions.

regex parsing numbers
+8 pts 12m
Strings & Text easy

Extract file extensions

Implement a function that extracts the extension from a filename according to standard rules.

strings parsing file-paths
+8 pts 10m
Strings & Text easy

Replace template variables

Implement a function that replaces {{variable}} placeholders in a string using a dictionary, leaving unknown placeholders intact.

string-manipulation parsing template
+10 pts 15m

Showing 22 challenges · easy · 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.