Discover and read the best of Twitter Threads about #coinflip

Most recents (1)

itertools.takewhile()

one of those good-to-know-about-functions

I decided to explore it today…

Read on if you've not come across takewhile before…

👇🪡🧵

#Python #coding #100daysofcode

1/7
takewhile takes successive items from a sequence for as long as a certain condition is true.

It's the equivalent of using a _while_ loop to _take_ successive items from the sequence until the while condition is not met–hence the name takewhile.

2/7
In this example, the challenge is to see how many successive heads I can get when I flip a coin…

3/7
Read 7 tweets

Related hashtags

Did Thread Reader help you today?

Support us! We are indie developers!


This site is made by just two indie developers on a laptop doing marketing, support and development! Read more about the story.

Become a Premium Member ($3.00/month or $30.00/year) and get exclusive features!

Become Premium

Too expensive? Make a small donation by buying us coffee ($5) or help with server cost ($10)

Donate via Paypal Become our Patreon

Thank you for your support!