Creating this pattern in python

Test for a valid input (it must be even number).

Calculate the number of groups (pairs) of rows and groups (pairs) of characters in each row (that’s the input divided by 2).

Make a loop for a desired number of groups of rows.

Inside it make a loop for two rows.

Inside it make loop for a desired number of groups of signs.

Inside it make a loop for a desired number (2) of chars in the group.

Print a sign, which is either ‘=’ if a parity of the number of a current rows’ group is the same as a parity of the number of a current chars’ group, ‘X’ otherwise.

At the end of each row (after the loop of chars group) print end of line.

Done.

Leave a Comment