[백준, BOJ 2444] 별 찍기 - 7 (python)
Problem Solving/BOJ

[백준, BOJ 2444] 별 찍기 - 7 (python)

728x90

https://happybplus.tistory.com/131

 

[백준, BOJ 10828] 스택 (python)

https://www.acmicpc.net/problem/10828 10828번: 스택 첫째 줄에 주어지는 명령의 수 N (1 ≤ N ≤ 10,000)이 주어진다. 둘째 줄부터 N개의 줄에는 명령이 하나씩 주어진다. 주어지는 정수는 1보다 크거나 같고,..

happybplus.tistory.com


728x90

 

내 생각

너무 당연하게 '*' 다음에도 공백이 올 줄 알았는데...

'*' 뒤에는 공백이 오지 않는다.

n = int(input())

for i in range(1, n+1):
    print(' '*(n-i), '*'*(i-1), '*', '*'*(i-1), sep='')
for i in range(n-1, 0, -1):
    print(' '*(n-i), '*'*(i-1), '*', '*'*(i-1), sep='')
728x90