5,337
edits
(→Usage) |
|||
Line 236: | Line 236: | ||
if __name__ == "__main__": | if __name__ == "__main__": | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===iterators and iterables=== | |||
iterators | |||
====zip==== | |||
[https://docs.python.org/3/library/functions.html#zip documentation] | |||
zip takes two iterables and combines them into an iterator of tuples | |||
i.e. zip([a1, ...], [b1,...]) = [(a1, b1), ...] | |||
====enumerate==== | |||
[https://docs.python.org/3/library/functions.html#enumerate documentation] | |||
enumerate adds indices to an iterable | |||
i.e. enumerate([a1,...], start=0) = [(0, a1), (1, a2), ...] | |||
==Classes== | ==Classes== |