4.2.1. 별 찍기 - 6 ¶
#백준 2443번 별찍기 - 6 a=int(input()) for i in range(2*a-1, 0, -2): for j in range(a-int(i/2)-1): print(' ', end='') for j in range(i): print('*', end='') print('')
4.3.1. 별 찍기 - 6 ¶
n = int(input()) stars = 2 * n - 1 space = 0 for i in range(n): for j in range(space): print(' ', end='') for j in range(stars): print('*', end='') for j in range(space): print(' ', end='') print('\n', end='') stars -= 2 space += 1
4.3.2. 별 찍기 - 7 ¶
n = int(input()) starModifier = 2 stars = 1 for i in range(2 * n - 1): space = (2 * n - 1 - stars) // 2 for j in range(space): print(' ', end='') for j in range(stars): print('*', end='') for j in range(space): print(' ', end='') print('\n', end='') if stars == (2 * n - 1): starModifier = -starModifier stars += starModifier