내용

글번호 876
작성자 허진경
작성일 2018-05-29 09:30:18
제목 다이아몬드 그리기 숙제
내용 #%% dan = 5 for i in range(0, dan): for j in range(0, dan-i-1): print(' ', end='') for j in range(0, (i*2)+1): print('*', end='') print() for i in range(0, dan-1): for j in range(0,i+1): print(' ', end='') for j in range(0,2*(dan-i)-3): print('*', end='') print() #%% dan = 5 for i in range(0, dan): for j in range(0, dan-i-1): print(' ', end='') for j in range(0,(i*2)+1): if j==2*i or j==0: print('*', end='') else: print(' ', end='') print() for i in range(0, dan-1): for j in range(0,i+1): print(' ',end='') for j in range(0,2*(dan-i)-3): if j==0 or j==2*(dan-i)-4: print('*', end='') else: print(' ', end='') print() #%% dan = 5 for i in range(0, dan): for j in range(0, dan-i-1): print(' ', end='') for j in range(0, (i*2)+1): if j==2*i or j==0: print('*', end='') else: if j%2==0: print('$', end='') else: print(' ', end='') print() for i in range(0, dan-1): for j in range(0, i+1): print(' ', end='') for j in range(0, 2*(dan-i)-3): if j==0 or j==2*(dan-i)-4: print('*', end='') else: if j%2==0: print('$', end='') else: print(' ', end='') print()