Created
March 25, 2022 02:49
-
-
Save RamsesMartinez/e829540118a5d74b15f54c7513d0447d to your computer and use it in GitHub Desktop.
Python Text Aligment Solution - HackerRank
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def print_logo(thickness): | |
c = 'H' | |
# Triangulo principal | |
for i in range(thickness): | |
print((c * i).rjust(thickness - 1) + c + (c * i).ljust(thickness - 1)) | |
# Columnas superiores | |
for i in range (thickness + 1): | |
print((c * thickness).center(thickness * 2) + (" " * thickness * 2) + (c * thickness).center(thickness * 2)) | |
# Barras medias | |
for i in range ((thickness+1)//2): | |
print((c * thickness * 5).center(thickness*6)) | |
# Columnas inferiores | |
for i in range (thickness + 1): | |
print((c * thickness).center(thickness * 2) + (" " * thickness * 2) + (c * thickness).center(thickness * 2)) | |
# Triangulo inferior | |
for i in range(thickness-1 , -1, -1): | |
print(((c*i).rjust(thickness-1)+c+(c*i).ljust(thickness-1)).rjust(thickness*6-1)) | |
if __name__ == '__main__': | |
thickness = int(input()) | |
print_logo(thickness) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment