Sophia had cooked a pie made from oil for her drones and left it in the kitchen. The Drones were returning home in small groups or by themselves and did not see each other upon their return, so each group did not know how many drones had eaten their slice of the pie. Some groups know about how big the pie was after Sophia removed it from the oven, but other groups don't know this and think the remaining part is the entire pie, then take their portion from the remaining. So each group had divided (mentally) the remaining or initial pie at all and took their part. How many parts will remain after all of the drones return?
Let’s take a look at an example of how this should work: There are 6 drones. The first group consists of 2 drones. They had divided the pie into 6 parts and took 2/6 of the pie. The remainder of the pie is 2/3 of the entire pie. Next returns a single drone, it doesn’t know about the original size of the pie, so it divides the remaining pie into 6 slices and takes 1 part. This leaves 10/18=5/9. The last group is 3 drones, which heard about the original size of the pie from Sophia. They took half of the original pie, so the remaining is 5/9 - 3/6 = 1/18
You are given an ordered array with sizes of the groups in the order they arrived. If a group knows about the initial pie size, then the size is positive. If not, then size will be negative. The recent example will given as (2, -1, 3).
divide_pie((2, -1, 3)) == (1, 18) divide_pie((1, 2, 3)) == (0, 1)
How it is used: This mission will familiarize you with operations involving fractions because we must deal with fractions every day of our lives.
all(x for x in groups)
all(-100 < x < 100 for x in groups)
CheckiO Extensions allow you to use local files to solve missions. More info in a blog post.
In order to install CheckiO client you'll need installed Python (version at least 3.8)
Install CheckiO Client first:
pip3 install checkio_client
Configure your tool
checkio --domain=py config --key=
Sync solutions into your local folder
(in beta testing) Launch local server so your browser can use it and sync solution between local file end extension on the fly. (doesn't work for safari)
checkio serv -d
Alternatevly, you can install Chrome extension or FF addon
checkio install-plugin --ff
checkio install-plugin --chromium
Welcome to Pair Programming! Engage in real-time collaboration on coding projects by starting a session and sharing the provided unique URL with friends or colleagues. This feature is perfect for joint project development, debugging, or learning new skills together. Simply click 'Start Session' to begin your collaborative coding journey!
You are trying to join a pair programming session that has not started yet.
Please wait for the session creator to join.
It looks like the creator of the pair programming session closed the editor window.
It might happen accidentally, so that you can wait for reconnection.