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 Repl​​​​​y

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

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

Get the code for the classic Retro Alien Blitz Game using Python Turtle Graphics when you join our mailing list