본문 바로가기

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

#253 백준 파이썬 [10996] 별 찍기 - 21

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

 

Python Code

N = int(input())

if N == 1:
    print('*')
    
else:
    if N % 2 == 0:
        a = '* ' * (N//2)
        b = ' *' * (N//2)
    else:
        a = '* ' * (N//2) + '*'
        b = ' *' * (N//2)
    
    for _ in range(N):
        print(a)
        print(b)