Python Beyond the Basics

Take Python from the browser to your own computer: cleaner code, tests, dataclasses, files and CSV, automation scripts, APIs and a first taste of data.

  • 0 students
  • 90 lessons
  • 6 h 33 min

Created by Ayim Nelson

What you will learn

  • Install Python 3, use the >>> shell and run scripts from the terminal
  • Write comprehensions, raise clear errors and document code with docstrings and type hints
  • Follow PEP 8 and test your code with unittest
  • Make classes friendlier with special methods and dataclasses
  • Read and write text and CSV files, and handle paths with pathlib
  • Automate file chores and write scripts with arguments, logging and a schedule
  • Call web APIs with urllib and requests, with timeouts and error handling
  • Summarise data with csv and statistics, and take a first look at pandas and charts

About this course

You know the basics of Python. This course shows you what comes next: running Python on your own computer, writing code that is cleaner and tested, and putting it to work on real jobs. Through Esi's provisions shop in Kasoa and a JHS class in Kumasi, you'll read and write files and CSV spreadsheets, tidy folders automatically, write scripts that take options, keep logs and run on a schedule, call web APIs safely and get a first taste of data analysis.

For: anyone who has finished the Python Crash Course (or knows variables, loops, lists, dicts, functions, try/except and simple classes) and wants to use Python for real work. The exercises run in your browser; the lessons show you how to do the same on your own computer.

By the end: you'll have Python set up at home, and you'll have built a sales report from a CSV file, a photo renamer, a folder-tidying script with a dry run and a log, a price checker that survives network failures and an end-of-term class report.

Course content

11 sections · 90 lessons

Python on your own computer11 lessons
Comprehensions7 lessons
  • List comprehensionsReading · 3 min
  • Filtering with ifReading · 3 min
  • Choosing values with if-elseReading · 3 min
  • Dict and set comprehensionsReading · 3 min
  • Comprehensions inside sum(), any() and all()Reading · 3 min
  • When a loop is clearerReading · 3 min
  • Results boardExercise · 10 min
Raising your own errors6 lessons
  • Why raise your own errorsReading · 3 min
  • The raise statementReading · 3 min
  • Choosing the error typeReading · 3 min
  • Catching errors you raisedReading · 3 min
  • Your own exception classesReading · 3 min
  • Mobile money transfer checkerExercise · 12 min
Docstrings, type hints and style8 lessons
  • DocstringsReading · 3 min
  • Type hintsReading · 3 min
  • Hints for lists, dicts and NoneReading · 3 min
  • Type hints are not checked when the code runsReading · 3 min
  • PEP 8: naming thingsReading · 3 min
  • PEP 8: layout and spacingReading · 3 min
  • Formatters and lintersReading · 3 min
  • Document the grade functionExercise · 10 min
Testing with unittest5 lessons
  • Your first unittest testReading · 4 min
  • More assert methodsReading · 3 min
  • Testing errors with assertRaisesReading · 3 min
  • Reading a failing testReading · 4 min
  • Test the transfer functionExercise · 12 min
Better classes9 lessons
  • __str__: how an object printsReading · 3 min
  • __repr__ for developersReading · 3 min
  • __eq__: comparing objectsReading · 3 min
  • __len__, __contains__ and __add__Reading · 3 min
  • DataclassesReading · 3 min
  • Default values and field()Reading · 3 min
  • Frozen and ordered dataclassesReading · 3 min
  • Checking values in __post_init__Reading · 3 min
  • Shop basketExercise · 12 min
Working with files11 lessons
  • Writing a text fileReading · 3 min
  • Reading a text fileReading · 3 min
  • Paths with pathlibReading · 3 min
  • Parts of a pathReading · 3 min
  • Reading and writing with PathReading · 3 min
  • Listing files with iterdir() and glob()Reading · 3 min
  • Reading CSV filesReading · 3 min
  • Rows as dicts with DictReaderReading · 3 min
  • Writing CSV filesReading · 3 min
  • Values with commas and quotesReading · 3 min
  • Kasoa shop sales reportExercise · 12 min
Automating everyday tasks7 lessons
  • What automation is good forReading · 3 min
  • Making folders and copying filesReading · 3 min
  • Moving and renaming filesReading · 3 min
  • Sorting a folder by file typeReading · 4 min
  • Renaming many files at onceReading · 3 min
  • Dry runs and deleting safelyReading · 3 min
  • Rename the trip photosExercise · 12 min
Scripts that run on their own9 lessons
  • Command-line arguments with argparseReading · 4 min
  • Options and flagsReading · 3 min
  • The free --help messageReading · 3 min
  • Logging instead of printReading · 4 min
  • Logging to a fileReading · 3 min
  • Running on a schedule with Task SchedulerReading · 4 min
  • Running on a schedule with cronReading · 4 min
  • Making a script ready to run aloneReading · 3 min
  • The daily tidy-up scriptExercise · 15 min
Talking to APIs8 lessons
  • Calling an API from PythonReading · 3 min
  • A practice API on your computerReading · 4 min
  • Fetching JSON with urllibReading · 3 min
  • When urllib failsReading · 3 min
  • Calling APIs with requestsReading · 3 min
  • TimeoutsReading · 3 min
  • Handling network failuresReading · 4 min
  • Price checker with a fake connectionExercise · 15 min
A taste of data9 lessons
  • Exploring data with PythonReading · 3 min
  • Totals by categoryReading · 3 min
  • Counting and averaging per groupReading · 3 min
  • The statistics moduleReading · 4 min
  • Jupyter notebooksReading · 3 min
  • pandas: tables in a few linesReading · 4 min
  • Charts with matplotlibReading · 3 min
  • End-of-term class reportExercise · 15 min
  • Final quizQuiz · 10 min

Reviews

No reviews yet.

Comments

Log in to join the conversation.

Loading comments...