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…
In recent years, I have introduced #Python#coding to chemists, biologists, psychologists, medical scientists, geologists, well, the list goes on.
Suffice to say that it spans all areas of science.
Why?
2/4
All of these teams and individuals realise that either they have large amounts of data they need to analyse in all sorts of different ways, or they need to simulate experiments and create computational models.
#Python is often the language of choice in many of these fields.
3/4
In this project, you'll get to use lists, tuples, dictionaries, and sets to set up the grid, colours, and get the balls to bounce and speed across the tiles.
It's fun to write, and fun to watch, too!
2 of 3
If you don't have the time for this but know someone who does, please do share…