Computational thinking - a puzzle about socks

Here’s a puzzle to help practice your computational thinking skills. Don’t forget to take it slowly and think through your answer carefully before committing.

A sock drawer contains ten pairs of black socks and ten pairs of white socks. If you are only allowed to take one sock from the drawer at a time and you can’t see what colour sock you are taking until you have taken it, how many socks do you have to take before you are guaranteed to have at least one matching pair?

If you want a fun programming challenge, why not write some code in your favourite language to simulate this problem?

Leave a Reply

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

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

Join our mailing list

Join our mailing list to receive awesome articles about learning Python and Computer Science in a fun and accessible way, straight to your inbox.

 Take your Python skills to the next level!

with our free email course on object oriented programming with Python