FINALR - EDITORIAL

Final Round - EDITORIAL:

Practice

Contest

Author: alphatron99

Editorialist: kishen1912000

DIFFICULTY:

CAKEWALK

PREREQUISITES:

Implementation

PROBLEM:

Given n,m print a checker board of size m\times n, where * denotes black squares and . denotes white squares.

EXPLANATION:

This is a straight-forward question. But, the main aim was to minimize the source-code size. Python is a very good choice in such questions. Check out the setter’s solution below. He uses the eval() function for handling the spaces in the input and fetch the numbers n and m. Then, he is printing the pattern .* repeated (but sliced at length n) if i is odd. Else, he is printing the pattern *. repeated (but sliced at length n). (i starts from 0).

The setter’s solution uses 68 characters. Feel free to share your approach, if it differs. Suggestions are always welcomed.

SOLUTIONS:

Setter's Solution
a,b=eval(input())
for i in range(b):
    print((a*'.*'[::i%2*2-1])[:a])