##21~30
letters = 'python' #21
print(letters[0], letters[2])
license_plate = "24가 2210" #22
print(license_plate[-4:])
string = "홀짝홀짝홀짝" #23
print(string[::2])
string = "PYTHON" #24
print(string[::-1])
phone_number = "010-1111-2222" #25
phone_number1 = phone_number.replace("-", " ")
print(phone_number1)
phone_number2 = phone_number.replace("-", "") #26
print(phone_number2)
url = "http://sharebook.kr" #27
url_split = url.split(".")
print(url_split[-1])
lang = 'python' #28 문자열은 수정 불가
lang[0]
string = 'abcdfe2a354a32a' #29 변수에 할당
string = string.replace('a', 'A')
print(string)
string = 'abcd' #30
string.replace('b', 'B') #문자열은 변경할 수 없으니까 변수에 할당 필요
print(string)
'Programming' 카테고리의 다른 글
파이썬 연습(wikidox) 61~70 (0) | 2022.05.28 |
---|---|
파이썬 연습(wikidox) 51~60 (0) | 2022.05.27 |
파이썬 연습(wikidox) 41~50 (0) | 2022.05.26 |
파이썬 연습(wikidox) 31~40 (0) | 2022.05.25 |
파이썬 연습(wikidox) 11~20 (0) | 2022.05.23 |