The slice_gen generator takes one iterable and a start, stop and step values (all int, with the same meanings as the values in a slice: [start:stop:step], except start and stop must be non-negative and step must be positive; raise an AssetionError exception if any is not). It produces all the values in what would be the slice (without every putting all the values in a list and slicing it). For example

Solved
Show answers

Ask an AI advisor a question