문제
다음 Python 프로그램의 실행 결과는?
data = {'name': 'Alice', 'age': 25, 'city': 'Seoul'} result = list(data.keys())[1:] print(result)
① ['name', 'age'] ② ['age', 'city'] ③ ['Alice', 25] ④ ['age', 'city', 'Seoul']
정답
2번
해설
keys()를 리스트로 변환하면 ['name', 'age', 'city']이고, [1:] 슬라이싱 결과는 ['age', 'city']이다.