Video: https://youtu.be/uGg8J7grQjw
Written version: https://cloudexplainers.com/every-python-concept-for-beginners-in-10-minutes/
Everything below ran for real in the video. Run it in a throwaway machine or container, never on a computer you care about.
The machine the video used, as files you can build it from:
lab/ask.pylab/ask_safe.pylab/line_total.pylab/line_total_fixed.pylab/order.pylab/receipt.pylab/shipping.pylab/teas.pylab/typo.py
# ana@laptop:~/shop$
cat order.py
python3 order.py# ana@laptop:~/shop$
python3
>>> tins = 2
>>> tins + 1
>>> type(tins)
>>> type("2")
>>> type(6.5)>>> name = "Ana"
>>> f"{name} ordered {tins} tins"
>>> name.upper()
>>> len("Sencha")>>> teas = ["Sencha", "Assam", "Oolong"]
>>> teas[0]
>>> teas[1]
>>> teas[-1]
>>> teas.append("Earl Grey")
>>> len(teas)
>>> teas[4]>>> prices = {"Sencha": 6.5, "Assam": 4.0}
>>> prices["Assam"]
>>> prices["Oolong"] = 8.0
>>> prices
>>> prices["Matcha"]
>>> prices.get("Matcha", 0)# ana@laptop:~/shop$
python3 shipping.py
python3 typo.py# ana@laptop:~/shop$
python3 teas.py# ana@laptop:~/shop$
cat line_total.py
python3 line_total.py
cat line_total_fixed.py
python3 line_total_fixed.py# ana@laptop:~/shop$
python3 ask.py
python3 ask_safe.py# ana@laptop:~/shop$
cat receipt.py
python3 receipt.py
python3 receipt.pyFrom Cloud Explainers. Lab files are MIT licensed (see the repository's LICENSE).