The Egg Farmer’s Puzzle

An egg farmer is picking up eggs every morning to sell on the local market. Every day, they are picking around 100 to 150 eggs and put these eggs into egg cartons of 12 eggs.

So for instance, if on Monday our farmer picks up 128 eggs, they will use 10 cartons of 12 eggs. (10 x 12 = 120 eggs). With the remaining 8 eggs they will use a carton of 6:

This will mean that the farmer will be left with 2 spare eggs that they will eat for breakfast!

Our farmer would like to use a computer program to help them in the morning to pick up the right number of egg boxes to pack up all the eggs.

Your task is to write a Python program that will:

    Ask the farmer to enter how many eggs they have picked up this morning.
    Work out how many boxes of 12 eggs will be needed today.
    Work out if the farmer will also need a box of 6.
    Finally let the farmer know how many eggs they will have left to cook for breakfast.

Python Codde

Your task is to complete the Python code below:

Test Plan

Is your code complete? Let’s make sure it works as expected by completing the following test plan:

Test # Input Values Expected Output Pass/Fail?
#1 Number of Eggs: 128 You will need 10 cartons of 12.
You will need 1 carton of 6.
You will have 2 eggs for breakfast!
#2 Number of Eggs: 149 You will need 12 cartons of 12.
You will have 5 eggs for breakfast!
#3 Number of Eggs: 105 You will need 8 cartons of 12.
You will need 1 carton of 6.
You will have 3 eggs for breakfast!
unlock-access

Solution...

The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 4.4 / 5. Vote count: 7

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!