itertools.count(start=0, step=1) - Deepstash

Explore the World's Best Ideas

Join today and uncover 100+ curated journeys from 50+ topics. Unlock access to our mobile app with extensive features.

itertools.count(start=0, step=1)

Returns an infinite iterator that produces evenly spaced values starting with number start.

It's often used in combination with map() to generate consecutive data points, and with zip() to add sequence numbers.

4

50 reads

MORE IDEAS ON THIS

Add sequence numbers

Add sequence numbers

Assume you have three lists and you want to turn them into a table-like structure, where each row has a numeric ID.

You can combine count() with zip() to add sequence numbers to the resulting tuples. See code in image.

3

26 reads

CURATED FROM

IDEAS CURATED BY

ocpodariu

Alt account of @ocp. I use it to stash ideas about software engineering

๐Ÿ Exploring itertools docs

โ€œ

Read & Learn

20x Faster

without
deepstash

with
deepstash

with

deepstash

Personalized microlearning

โ€”

100+ Learning Journeys

โ€”

Access to 200,000+ ideas

โ€”

Access to the mobile app

โ€”

Unlimited idea saving

โ€”

โ€”

Unlimited history

โ€”

โ€”

Unlimited listening to ideas

โ€”

โ€”

Downloading & offline access

โ€”

โ€”

Supercharge your mind with one idea per day

Enter your email and spend 1 minute every day to learn something new.

Email

I agree to receive email updates