Strings and Text Python practice

0 / 20 solved
Question 1 of 20 Easy Compute a value

Length of a product name

An online grocery store limits product names to a fixed number of characters on its app.

The variable product_name (a string) is already defined. Create a variable named name_length that holds the number of characters in product_name. Spaces count as characters too.

Python 3.13 Python loads when you start

Press Run to see what your code prints, or Submit to check it against every test.

Section 2 of 16

Strings and Text

Indexing, slicing, string methods, searching, splitting, joining and cleaning text fields.

indexing and slicinglen, upper/lower/title, stripfind, count, replace, startswith/endswithsplit and joinformatting and alignmentmembership with incleaning messy text such as names, emails, product codes
FAQ

Indexing, slicing, string methods, searching, splitting, joining and cleaning text fields. Topics: indexing and slicing, len, upper/lower/title, strip, find, count, replace, startswith/endswith, split and join, formatting and alignment, membership with in, cleaning messy text such as names, emails, product codes.

Run shows your output and the example tests. Submit runs every test, including hidden ones, so a hard-coded answer will not pass. Decimals are compared to 6 places and printed output ignores trailing spaces.

Yes, for 5 easy, 2 medium and 1 hard question across the Python Playground. A free account unlocks every question and saves your progress and code.