본문 바로가기

Programming [Python]/백준 알고리즘 솔루션

#242 백준 파이썬 [10992] 별 찍기 - 17

https://www.acmicpc.net/problem/10992

 

Python Code

N = int(input())

for i in range(1, N+1):
    if i == N:
        print('*'*(2*i-1))
    elif i == 1:
        print(' '* (N-i),'*',sep = '')
    else:
        print(' '* (N-i),'*',' '*(2*i-3),'*', sep = '')