🐍🐍 Python part one 🐍🐍¶

Why Python? The trade-off¶

Why Python? It gives you wings¶

Why Python?¶

  • readable
  • free to use
  • cross-platform
  • well documented
  • widely used

✨ Lesson outline ✨¶

  1. Running Python
  2. Variables and assignment
  3. Data types and type conversion
  4. Built-in functions, help and errors
  5. Lists

Programming can be frustrating¶

In programming, the little things matter! An extra full-stop or the smallest typo will stop your code running

Plain text vs. Jupyter Notebook¶

  • Plain text approach:

    • write code in a text editor
    • save with a .py extension
    • run code using a terminal
  • Jupyter notebook approach:

    • write code in a jupyter notebook
    • run code in a jupyter notebook
    • save with a .ipynb extension

Data types¶

Data type Python name Definition Example
integer int positive or negative whole numbers -256
float float real number -3.16436
string str character string "20 pence."
list list a sequence of values ['frog',2,8]

+ boolean, dict, tuple, complex, None, set

</small>

Lists¶

Data type Python name Definition Example
integer int positive or negative whole numbers -256
float float real number -3.16436
string str character string "20 pence."
list list a sequence of values ['frog',2,8]

</small>

✨ Lesson Outline ✨¶

  1. running python code: Jupyter Notebooks, markdown basics
  2. variables: variable names, variable assignment, print(), execution order
  3. data types: integer, float, string, list, len(), string operations/indexing/slicing, type conversion: int(), str(), float()
  4. functions, help and errors: min(), max(), round(), help(), runtime errors (exceptions), syntax errors
  5. lists sequence type, immutable vs mutable, list method append, del
In [ ]: