STEM

Python teaser/puzzle 45588-1312

This is a quick Python coding puzzle or brain teaser for educational and/or entertainment purposes. The challenge is quite simple but is useful for learning or refreshing your coding skills while exercising some logical thinking.

Objective

Write a Python function that takes a list of integers as input and returns the 2 numbers that add up to the largest sum from that list. For example, given a list input: 1, 3, 4, 6, 8, 9 the function should return (8, 9) because of all the numbers, 8 + 9 = 17 is the largest sum possible from a pair of numbers in the list.

Click Run on the widget below to run the solution.

Try to solve it yourself first. If you’re stumped, click here for the solution.

I hope you found this post helpful and interesting. Explore this site for more tips and articles. Be sure to also check out my Patreon site where you can find free downloads and optional fee-based code and documentation. Thanks for visiting!

For more brain teasers and puzzles, click here.

Leave a Reply

Your email address will not be published. Required fields are marked *

Back To Top