© James R. Payne 2019
James R. PaynePython for Teenagershttps://doi.org/10.1007/978-1-4842-4550-7_10

10. Python Files

James R. Payne1 
(1)
Deerfield Beach, FL, 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 includes you now – work.

There are many reasons why we would use multiple files of code. Some of that centers around efficiency and reducing errors in our code – remember our whole bit about saving parts of programs that ...

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.