본문 바로가기

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

#247 백준 파이썬 [10990] 별 찍기 - 15

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

 

Python Code

N = int(input())

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