#문자열 str : 문자들이 모여서 만들어진 자료형 '' ""

t1 = '파이썬'
t2 = '썬파이'
print(t1 == t2)

#인덱스는 0부터 시작!!

#인덱싱 : 원소 하나를 가져오는 것
# 문자열[인덱스]
t3 = '안녕하세요'
print(t3[0])
print('안녕하세요'[3])
print(t3[-4])

#슬라이싱 : 일부를 잘라서 가져오는 것
# 문자열[start시작:end종료:step칸]
#end종료 인덱스는 포함하지 않는다!! 
t4 = '파이썬은 재미있어요!'
print(t4[0:6])
print(t4[5:7])
print(t4[:10:2]) # 시작 -> 0부터 (처음부터)
print(t4[1::3]) # 종료 -> 끝까지
print(t4[5:11:]) # 칸 -> 1칸씩
print(t4[-10:-2:2])
print(t4[::-2])
print(t4[-1:-9:-4])







Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: