We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Somehow, i made the test 0 worked, but not the others, can anyone tell where is wrong?
n = int(input())
for i in range(1,n+1):
print(('H'*(2*i-1)).center(2*n-1,' '))
for i in range(0,n+1):
print(('H'*n).center(2*n-1,' '),('H'*n).center(6*n,' '))
for i in range(0,n-2):
print(('H'*5*n).rjust(5*n+2,' '))
for i in range(0,n+1):
print(('H'*n).center(2*n-1,' '),('H'*n).center(6*n,' '))
for i in range(1,n+1):
print(('H'*(2*n-(2*i-1))).rjust((5*n+5)-i,' '))
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Text Alignment
You are viewing a single comment's thread. Return to all comments →
Somehow, i made the test 0 worked, but not the others, can anyone tell where is wrong? n = int(input()) for i in range(1,n+1): print(('H'*(2*i-1)).center(2*n-1,' ')) for i in range(0,n+1): print(('H'*n).center(2*n-1,' '),('H'*n).center(6*n,' ')) for i in range(0,n-2): print(('H'*5*n).rjust(5*n+2,' ')) for i in range(0,n+1): print(('H'*n).center(2*n-1,' '),('H'*n).center(6*n,' ')) for i in range(1,n+1): print(('H'*(2*n-(2*i-1))).rjust((5*n+5)-i,' '))