Cheuk Ting Ho
Developer advocate / Data Scientist - support open-source and building the community.
Online Absolute Beginner Python Tutorials
Every Sunday 2pm (UK time/ BST)
by Cheuk Ting Ho
Get this slide deck:
Python objects - int, float, str, list, dict, bool
Control flows - if-else, for loop, while loop
Functions, modeuls, classes and decorators
strings operations and regex with re
pytest with fixtures and mock
python linters & auto-formatters
Generator functions allow you to declare a function that behaves like an iterator, i.e. it can be used in a for loop.
Python generators are a simple way of creating iterators.
Compare to implement a class with __iter__() and __next__() method.
def firstn(n): num = 0 while num < n: yield num num += 1
The send() method resumes the generator and sends a value that will be used to continue with the next yield. The method returns the new value yielded by the generator.
def numberGenerator(n): number = yield while number < n: number = yield number number += 1 g = numberGenerator(10) # Create our generator next(g) # print(g.send(5))
def generator1(): for item in generator2(): yield item
def generator1(): yield from generator2()
Sunday 2pm (UK time/ BST)
This week no Mid Meet Py because:
By Cheuk Ting Ho