Programming language
python * 찍기 프로그램
taehwan
2012. 4. 14. 02:52
Python 으로 * 찍는 프로그램입니다. 앞에 올렸던 Objective c 와 결과 값이 동일합니다.
Objective c 프로그램
소스코드
''' Created on Apr 14, 2012 @author: taehwan, taehwan@thdev.net ''' print 'rowspan : ', rowspan = raw_input() print 'colspan : ', colspan = raw_input() rowspan = int(rowspan) * 2 - 1; colspan = int(colspan) * 2 - 1; for i in range(0, rowspan): for j in range(0, colspan): val = i % 2 if val: value = j % 2 if value: print '*', else: print ' ', else: value = j % 2 if value: print ' ', else: print '*', print '\n'