Review

Key Ideas

  • Python runs exact code.
  • A script is a saved file that Python can rerun.
  • The terminal can start Python and pass it a file to run.
  • An interactive session is useful for small checks.
  • Output is what the program prints.
  • Errors are reports about where Python got stuck.
  • Change one thing, rerun, and compare.

Key Commands

CommandUse
python3 --versioncheck Python 3 on macOS or Linux
py -3 --versioncheck Python 3 on Windows
python --versionalternate version check on some systems
python3 hello.pyrun a script on macOS or Linux
py -3 hello.pyrun a script on Windows
pwdshow the current folder
lslist files on macOS or Linux
dirlist files in Windows PowerShell

Common Mistakes

MistakeFix
Running a command that does not exist on your systemtry the command for your operating system
Running a file from the wrong foldercheck the current folder and file name
Pasting >>> into a scriptremove the interactive prompt marker
Reading the whole traceback at oncestart near the last useful line
Editing many things before rerunningchange one thing at a time

Checklist

You are ready to move on if you can:

  • explain what print() does
  • run a tiny script
  • predict the output of two print() lines
  • recognize a Python 3 version
  • read a basic NameError
  • edit one value and rerun the code

If You Feel Lost

Return to the smallest possible script:

Run it. Change one word. Run it again. Confidence comes from seeing the loop work repeatedly.