찬란하게

[백준] 문자열_알파벳 내장함수 본문

알고리즘/백준

[백준] 문자열_알파벳 내장함수

체리핫 2023. 5. 29. 20:32

체크포인트 1. 알파벳 내장함수

import string

lower = [i for i in string.ascii_lowercase]
print(lower)

 

2. 리스트 컴프리핸션

+ 문자열 index : s.index('a')

++ 리스트 출력 : print(*list)

import string
s = input()
lower = [s.index(i) if i in s else -1 for i in string.ascii_lowercase]
print(*lower)
# s.index('a')