3 Functions: Don’t repeat yourself!
In this chapter
- Simon explains how to avoid repeating yourself (and why)
- Erik writes his first Python function
- Erik starts using Python’s interactive tool
- Erik improves his function to make his receipt look professional
“Where did we stop yesterday?” Simon asked Erik the next day.
“You were going to tell me why bugs are called bugs,” Erik said.
“Right!” Simon said. “Believe it or not, many years ago, computers were made of electro-mechanical things called relays that had contacts similar to light switches. One day, the engineers discovered an error in their program. Their code was correct, but they found a bug stuck between the contacts in one of the relays. That’s why programmers call errors bugs. The bugs ...
Get A Pythonic Adventure now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.