python
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| python [2026/02/25 17:56] – donald | python [2026/04/28 16:34] (current) – [error: externally-managed-environment] donald | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Python ====== | ====== Python ====== | ||
| + | ===== create window usb install ===== | ||
| + | |||
| + | === Using WoeUSB-NG (Recommended GUI) === | ||
| + | < | ||
| + | sudo apt update | ||
| + | sudo apt install git p7zip-full python3-pip python3-wxgtk4.0 | ||
| + | |||
| + | sudo pip3 install WoeUSB-ng --break-system-packages | ||
| + | </ | ||
| + | |||
| + | Run woeusb from the application menu | ||
| + | |||
| + | ===== error: externally-managed-environment ===== | ||
| + | |||
| + | < | ||
| + | pip install < | ||
| + | </ | ||
| + | |||
| + | ===== Testing for odd ===== | ||
| + | |||
| + | < | ||
| + | num = 7 | ||
| + | if num % 2 != 0: | ||
| + | print(f" | ||
| + | </ | ||
| + | |||
| + | ===== Lists ===== | ||
| + | |||
| + | * Lists are Python' | ||
| + | * They are mutable and zero based indexed. | ||
| + | * list = [' | ||
| + | * if ' | ||
| + | |||
| + | ===== Importing code ===== | ||
| + | |||
| + | * from //machine import PIN// means get the PIN class from the file machine | ||
| + | * from //ir_rx.nec import nec_8// means get the NEC_8 class from the file nec in the directory ir_rx | ||
| + | |||
| + | ===== Range ===== | ||
| + | |||
| + | * Range is start, stop, step to generate a range of numbers | ||
| + | < | ||
| + | # print 0 - 4 | ||
| + | for i in range(5): | ||
| + | print(i) | ||
| + | </ | ||
| + | |||
| + | |||
| + | |||
| + | | ||
| + | | ||
| ===== Passing Variables ===== | ===== Passing Variables ===== | ||
| + | *** Use classes!** | ||
| * Python will not change what I think are global variables in functions. | * Python will not change what I think are global variables in functions. | ||
| * If, for example, you have a variable xyzzy, and you reference it in a function, python creates a new one. | * If, for example, you have a variable xyzzy, and you reference it in a function, python creates a new one. | ||
| Line 27: | Line 79: | ||
| < | < | ||
| - | xyzzy = incrementXyzzy(xyzzy): | + | |
| - | #the calling function | + | #the calling function |
| </ | </ | ||
python.1772042183.txt.gz · Last modified: 2026/02/25 17:56 by donald
