N = int(input()) minus = 1 for Repeat in range(0, 2 * N - 1): if 2 * N - Repeat > N: for repeat in range(0, Repeat): print(" ", end = "") for Rpt in range(0, 2 * N - minus): print("*", end = "") minus += 2 if Repeat == N - 1: minus -= 4 else: for repeat in range(0, 2 * N - Repeat - 2): print(" ", end = "") for Rpt in range(0, 2 * N - minus): print("*", end = "") minus -= 2 print("")
소스를 조금 더 간단하게 해보려고 했지만 이게 최대인거 같다. N = int(input()) minus = 2 for Repeat in range(1, N * 2): if N - Repeat >= 0: for repeat in range(0, Repeat): print("*", end = "") for Rpt in range(0, N * 2 - minus): print(" ", end = "") for rpt in range(0, Repeat): print("*", end = "") minus += 2 if N - Repeat == 0: minus -= 4 else: for repeat in range(0, 2 * N -Repeat): print("*", end = "") for Rpt in range(..
지금까지 나온 문제들을 잘 섞어보자 N = int(input()) minus = 2 for Repeat in range(1, 2 * N): if N - Repeat >= 0: for repeat in range(Repeat, N): print(" ", end = "") for rep in range(0, 2 * Repeat - 1): print("*", end = "") else: for Rpt in range(0, -(N - Repeat)): print(" ", end = "") for rpt in range(1, 2 * N - minus): print("*", end = "") minus += 2 print("")