Use Python to Find the Highest Score

Use Python to Find the Highest Score

You have three quiz scores on a page and want to know which is highest. You could scan them by eye, but a tiny Python example shows how a computer can repeat the same check on a much longer list. Start with a short list so every step stays visible.

Put scores in a list

In Python, write scores = [72, 88, 91]. The square brackets hold several values together, and commas separate one score from the next. This collection is called a list, and you can give it a name that describes what it contains.

Try changing one number and running the line again. Keeping the example small makes it easier to connect what you typed with the values Python now has available.

Ask for the largest value

Now write highest_score = max(scores). The built-in max function looks through the values in the list and returns the largest one, which in this example is 91. To display the answer, write print(highest_score) on the next line.

Notice that max(scores) does not change the list; it gives you an answer based on the values already there. If you replace the scores with temperatures, prices, or another set of numbers, the same idea still works.

Know what this answer means

The result tells you the largest number, not who earned it or whether it is unusual. To answer those questions, you would need to store more information and decide what comparison you want Python to make. One small lesson at a time is enough: first, get comfortable putting values in a list and asking a clear question about them.

If you’d like a guided next step, look for a beginner Python course with short coding exercises you can run as you learn. Some course links we recommend may be affiliate links; Learn Data Daily may earn a commission at no extra cost to you. You can also get one small data tip each week through the newsletter.