← Back to challenges

Recreating a len() Function

PythonMediumloopslanguage_fundamentals

Instructions

Create a function which returns the length of a string, without using len().

Examples

length("Hello World") ➞ 11

length("Sample") ➞ 6

length("wash your hands!") ➞ 16

Notes

N/A

python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Skip the Drinks with Too Much Sugar