python

Advanced Topics in Python

We are gonna discuss some advanced topics beyond common usage in string, list, tree in python. See what we've got here..

Bowen She

2 minute read

class myIterator:
    def __init__(self):
        pass

    def __iter__(self):
        return self

    def __next__(self):

The protocol to create an Iterator contains two main parts: __iter__ and __next__. The __iter__ returns the object we want to iterate over and the __next__ mehtod is automatically on eahc iteration and that returns the value for the current iteration. Notice: Python 2 use next and Python 3 use __next__()

Python Quiz 01

Do you know all the frequently used ticks in Python?

Bowen She

3 minute read

Bring out a white paper and write all the answers to the quiz on the paper. See if you can finish all of these answers.