Python Code Example Files

From OpenCircuits
Revision as of 06:42, 11 April 2020 by Russ hensel (talk | contribs) (Created page with "= What/Why = When I learn a new thing in Python I often keep an example file. I can then use it for reference and/or copy code out of it for other uses. I have a few "tricks"...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

What/Why

When I learn a new thing in Python I often keep an example file. I can then use it for reference and/or copy code out of it for other uses. I have a few "tricks" that I will describe here. I like to have many examples in one file to make them easy to review, and find the right example. Comments can be used to turn on/off some of the code. I use a technique to make it easy to control examples by commenting a single line: put each example in a function and then comment in/out the function call.

How

I think this is best seen with a commented example file. The example is very simple, the central point is the technique of using subroutines. You should be able to copy the code into your IDE of choice and run it.


comming...