Home My space log
Language EN (English)

Find the flipped card

Python Advanced astronaut ages teen+ From CS Unplugged

The problem

A grid of cards is given as a list of rows, like ["BBW", "BWB", "WBB"]. Every row and every column should have an even number of B. Someone flipped one card. Write a function find_flipped_card(rows) that gives back [row, column] of that card, counting from 1. If every row and column is fine, give back None.

You will practice: lists of text, nested loops, parity, error correction

Mode

Press Tab to indent. Press Esc and then Tab to move on to the next button.

Your code runs in your browser. We do not receive it or save it. Python is downloaded from cdn.jsdelivr.net the first time you run it (about 10 MB).

Test results

      What your code printed

      
          

      CC BY-SA 4.0

      Adapted from a CS Unplugged programming challenge by the University of Canterbury Computer Science Education Research Group, licensed CC BY-SA 4.0.

      Original challenge · License: CC BY-SA 4.0

      Changes: Rewritten in our own words as a function with tests, hints and steps, in Python and JavaScript, by Open Cosmos. This version is also CC BY-SA 4.0.