Practical Python · Lesson 56 of 76

Organizing code

As programs grow, keep them tidy by splitting work into small functions with clear names. Each function should do one thing.

Python

Small, well-named functions are easier to read, test, and reuse than one giant block. When a function gets long or hard to name, that's a hint to split it.

Your turn: add a function shout(name) that returns the name in upper case, and call it on nice.

You’re reading for free. Sign in to save your progress, ask questions on any lesson, and earn a certificate when you finish.Sign in to keep my progress →

Lesson 56 of 76