Python Zero to Heros

Online Absolute Beginner Python Tutorials 

Every Sunday 2pm (UK time/ BST)

Get this slide deck:


Beginner topics:

Python objects, Control flows,

Functions, modeuls, classes and decorators

strings operations and regex with re


pytest with fixtures and mock

property-based testing

python linters & auto-formatters

TDD, type hinting

Intermedite topics:

Iterators, generators, async


generating docs, pypi

What is functional programming?


In computer science, functional programming is a programming paradigm where programs are constructed by applying and composing functions. -wikipedia

num_list = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
result = 0
for num in num_list:
  if num % 2 == 0:
    result += num * 10
from functools import reduce
result = reduce(lambda x,y: x+y,
                map(lambda a: a*10,
                    filter(lambda n: n%2==0,
                           [1, 2, 3, 4, 5, 6, 7, 8, 9, 10])))

Why functional programming?



  • pure functions are simple to understand
  • The arguments and return type of pure functions are given out by their function signature.
  • avoid changing variables or any data outside it
  • lazy evaluation is possible
  • no hidden outputs
  • enhances the comprehension and readability of the code

Why functional programming?



  • reduction in performance
  • in some cases, the code is hard to read
  • combining pure functions could be tough
  • recursive style in place of using loops can be a daunting task

What do we need?

Lambda function








Let's try them out

Next week:
More list and dict

Sunday 2pm (UK time/ BST)

There are also Mid Meet Py every Wednesday 1pm

Python Functional Programming

By Cheuk Ting Ho

Python Functional Programming

  • 935