'목록하단 광고 치환자(withSeok)
728x90
A190

str2="Hello Python"
str2[99# 너무 큰 첨자는 오류 발생

 

A191

str3="Hello Python"
print(str3[3:99]) # 오류 안남
print(str3[90:99]) # 오류 안남
print('위칸은 오류나지 않은 빈칸이다.')
# 슬라이싱은 첨자와 달리 범위를 벗어나도
# 오류 발생이 없다.

 

A192

str4="Hello Python4"
str4[0] = "Z" # 문자열은 변경할 수 없다.에러~!!

 

A193

# 문자열 억지로~ 변경
str5="Hello Python5"
str6="Z"+str5[1:]
str6

 

A194

str7="Hello Python7"
str8="HelloPython7"
print(len(str7)) # 문자열 길이 len
print(len(str8)) # 공백도 길이 +1

 

A195

# 글자 거꾸로 배열 프로그램
out_str=""
count, k =0,0
int_str=input('글자 입력 : ')
count=len(int_str)
for k in range(0,count):
  out_str += int_str[count-(k+1)]
  print(out_str)
print()
print('최종 결과 : %s' %out_str)

 

A196

 

 

A197

 

 

 

A198

 

 

 

A199

 

 

 

728x90

+ Recent posts