© The Author(s), under exclusive license to APress Media, LLC, part of Springer Nature 2024
J. R. PaynePython for Teenagershttps://doi.org/10.1007/978-1-4842-9988-3_10

10. Python Files

James R. Payne1  
(1)
Gainesville, GA, USA
 

So far, we have worked primarily within one file; that is, all of our code has been saved in a single .py file and run from that same file. However, in the real world, a lot of our programs will be stored in multiple files. What’s more, we are likely to save some of our favorite code snippets and functions in files for later use. It is just the way we programmers – which include you now – work.

There are many reasons why we would use multiple files of code. Some of those centers around efficiency and reducing errors in our ...

Get Python for Teenagers: Learn to Program like a Superhero! 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.