반응형
22.10 심사문제: 2의 거듭제곱 리스트 생성하기
srt, end = map(int, input().split())
list = []
for i in range(srt, end+1):
a = 2**i
list.append(a)
del list[1]
del list[-2]
print(list)
23.7 심사문제: 지뢰찾기
col, row = map(int, input().split())
matrix = []
for i in range(row):
matrix.append(list(input()))
for i in range(col):
for j in range(row):
if matrix[i][j]=='*':
print('*',end='')
else:
count=0
for k in range(i-1,i+2):
for l in range(j-1,j+2):
if k<0 or k>=row or l<0 or l>=row:
continue
elif matrix[k][l]=='*':
count+=1
print(count,end='')
print()
24.5 심사문제: 특정 단어 개수 세기
stc = '''the growns-ups response, this time, was to advise me to lay aside my drawings of boa
constrictors, whether from the inside or the outside, and devote myself instead to
geography, history, arithmetic, and grammer. That is why, at the, age of six, I gave up
what might have been a magnificent career as a painter. I had been disheartened by the
failure of my Drawing Number One and my Drawing Number Two. Grown-ups never understand
anything by themselves, and it is tiresome for children to be always and forever
explaining things to the.'''.split()
cnt = 0
for i in stc:
if i.strip('.,') == 'the':
cnt+=1
print(cnt) //6
24.6 심사문제: 높은 가격순으로 출력하기
p = list(map(int, input().split(';')))
p.sort(reverse=True)
for i in p:
print('%9s' % format(i, ','))
반응형
'PYTHON > 파이썬 코딩 도장' 카테고리의 다른 글
파이썬 도장 코딩 UNIT 29, 30, 31, 32 (0) | 2022.07.29 |
---|---|
파이썬 코딩 도장 UNIT 25, 26, 27, 28 심사문제 (0) | 2022.07.26 |
파이썬 코딩 도장 UNIT 19, 20, 21 심사문제 (0) | 2022.07.26 |
파이썬 코딩 도장 UNIT 16, 17, 18 심사문제 (0) | 2022.07.26 |
파이썬 코딩 도장 UNIT 13, 14, 15 심사문제 (0) | 2022.07.25 |