7 / 7
Jun 2016

h = '*.'
g = h*98 + '*'
t=int(raw_input())
if t>=1 and t<100:
l,c = raw_input().split()
l = int(l)
c = int(c)
if 1<=l<100 and 1<=c<100:
for i in range(l):
print g[0:c]

  • created

    Jun '16
  • last reply

    Jun '16
  • 6

    replies

  • 1.1k

    views

  • 2

    users

  • 1

    link

Your code does not compile. Please correct your post (select the complete code and hit "preformatted" or use other markups).

h = '*.'
g = h*98 + '*'
t=int(raw_input())
if t>=1 and t<100:
    l,c = raw_input().split()
    l = int(l)
    c = int(c)
    if 1<=l<100 and 1<=c<100:
        for i in range(l):
            print g[0:c]

Is your code meant to look like this? Indentation is important for python programs! If yes, you still need to build a loop over the t test cases and some logic to print alternating lines.

h = '*.'
k = '.*'
g = h*98 + '*'
h = k*98 + '.'
t=input()
if t>=1 and t<100:
for z in range(t):
      l,c = raw_input().split()
      l = int(l)
      c = int(c)
      if 1<=l<100 and 1<=c<100:
          for i in range(l):
               if i%2== 0 or i==0:
                   print g[0:c]
               else:
                   print h[0:c]

yes,my code worked sometime back...Although I need to figure out using formatting while discussing code in forum

You can follow this hint. It works to use triple backticks

```

on separate lines before and after your code. Although this character is quite unconvenient to produce on my german keyboard layout. Or you can use

[code] ... [/code]

And I wish there would be a sticky post (again) in this forum for all the beginners asking their first question.

Suggested Topics

Want to read more? Browse other topics in Online Judge System or view latest topics.