정성훈
    추가 도전문제 (모범 답안)



1
2
3
4
5
6
7
8
9
s = "Hello, WORLD. KOREA"
 
s_idx = 7  # 소문자 변경 시작 index
e_idx =12  # 소문자 변경 종료 index
 
t = s[s_idx:e_idx]
t= t.lower()
s_modify = s[:s_idx] + t + s[e_idx:]
print(s_modify)
cs

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
s = "Hello, WORLD. KOREA"
 
s_idx = 7  # 소문자 변경 시작 index
e_idx =12  # 소문자 변경 종료 index
 
s_modify =""
 
for i,c in enumerate(s):
    if i>=s_idx and i<e_idx :
        s_modify += c.lower()
    else:
        s_modify += c
 
print(s_modify)
cs

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
s = "Hello, WORLD. KOREA"
 
s_idx = 7  # 소문자 변경 시작 index
e_idx =12  # 소문자 변경 종료 index
 
s_modify =""
i = 0
for c in list(s) :
    if i>=s_idx and i<e_idx :
        s_modify += c.lower()
    else:
        s_modify += c
    i += 1
 
print(s_modify)
cs

  등록일 : 2023-05-25 [13:45] 조회 : 897 다운 : 0   
 
△ 이전글(추가 도전문제) 문자열의 일부분만 소문자로 변경
▽ 다음글도전문제 9.6
Python for AI 실습게시판
번호 ⓒ 제 목 조회 등록일
Anaconda3 설치
ColabTurtlePlus
실습 목록
Colab 실습
실습 시 학생들이 자주하는 실수 예들
281 └❶ llab_10_3.py (교재) 1533 02-21
280 └❶ llab_10_2.py (교재) 1373 02-21
279 └❶ lcode_10_5.py (교재) 1140 02-21
278    └❷ lcode_10_5_3.py (교재) 1123 02-21
277    └❷ lcode_10_5_2.py (교재) 1069 02-21
276    └❷ lcode_10_5_1.py (교재) 1150 02-21
275 └❶ llab_10_1.py (교재) 1035 02-21
274 └❶ lcode_10_3.py (교재) 1260 02-21
273 (9장) 텍스트를 처리해보자 1584 02-19
272 └❶ (추가 도전문제) 문자열의 일부분만 소문자로 변경 820 05-25
271    └❷ 추가 도전문제 (모범 답안) 897 05-25
270 └❶ 도전문제 9.6 1354 04-26
269    └❷ 도전문제 9.6 (모범 답안) 1378 04-26
268 └❶ 도전문제 9.5 1302 04-26
267    └❷ 도전문제 9.5 (모범 답안) 1191 04-26
266 └❶ 도전문제 9.4 1303 04-26
265    └❷ 도전문제 9.4 (모범 답안) 1169 04-26
264 └❶ 도전문제 9.3 1447 04-26
263    └❷ 도전문제 9.3 (모범 답안) 1221 04-26
262 └❶ 도전문제 9.2 1709 04-26

[1][2][3][4][5][6][7][8][9][10]-[Next][20]