Metasnake-Python-Tips Temp
Metasnake-Python-Tips Temp
Python Basics
This handout will cover Python programming basics for those looking to use Python for data‑related
tasks. Python is a versatile language that is easy to learn and use. Check out store.metasnake.com for
more professional Python and data‑related materials.
Installation - Conda
• Install Anaconda (for Python 3) from anaconda.com/downlaod
• Install libraries:
• Launch Jupyter:
jupyter lab
Installation - Python.org
• Install Python 3
• Windows:
1
env/Scripts/activate
• Unix (Mac/Linux):
$ source env/bin/activate
• Install libraries:
• Launch Jupyter:
$ jupyter lab
Jupyter
• Command Mode:
– a ‑ Above
– b ‑ Below
– CTL-Enter ‑ Run
– c, x, v ‑ Copy, cut, paste
– ii ‑ Interrupt Kernel
– 00 ‑ Restart Kernel (zero two times)
• Edit Mode:
– TAB ‑ Completion
– Shift-TAB ‑ Documentation
– ESC ‑ Back to command mode w/o running
– CTL-Enter ‑ Run
• Hints:
Variables
• You don't need to declare variables. Just put their name followed by =
• Don't name variables keywords (see help(); keywords)
• Don't name variables built‑ins (see dir(__builtins__))
• See PEP 8 http://legacy.python.org/dev/peps/pep-0008/
Copyright 2024 2