강의

멘토링

커뮤니티

Inflearn Community Q&A

hewon88833876's profile image
hewon88833876

asked

Getting Started with Programming: Introduction to Python (Inflearn Original)

for statement (2-2)

04-02 예제 3번 질문입니다.

Written on

·

180

0

예제 3번에서 Beautiful은 하나의 문자열이기 때문에 for구문으로 실행시켰을때 Beautiful로 출력되어야 하는 것 아닌가요?

왜 B,e,a,u,t,i,f,u,l 이렇게 한 단어씩 출력되나요?

python

Answer 1

0

niceman님의 프로필 이미지
niceman
Instructor

안녕하세요!

str 문자열이라 내부적으로 iterable 하므로 한 문자 씩 출력되요!

뒷 부분에 str 을 slice , to list 등으로 필요한 대로 변환할 수 있어요!

hewon88833876's profile image
hewon88833876

asked

Ask a question