How many sweets in the jar?

how-many-sweets-in-the-jar“Guess how many sweets are in the jar” is a fundraising game. A large see-through jar is filled with a carefully counted number of sweets. People then try to guess how many sweets are in the jar. Each contestant has to donate a small amount of money to have a go. Guesses are recorded (name + guess). At the end of the game, the nearest guesser wins the content of the jar.

In this challenge we are using a Python script to record the names and guesses (number of sweets) of each contestant. We record this information in a list of lists called guesses.

Your challenge is to complete this code from line 63 to scan through all the guesses from this list and find out who has the nearest guess!

Share Button
Posted in Computer Science, Python - Intermediate, Python Challenges Tagged with: ,

Our Latest Book