Python출력 결과보통 · 20점#문자열

16. 문자열 메서드와 포매팅 출력

다음 Python 프로그램의 실행 결과를 쓰시오.

1s = " step by step code "
2t = s.strip()
3print(len(s), len(t))
4words = t.split(" ")
5print(words)
6print(t.count("step"), t.find("by"), t.find("z"))
7u = t.replace("step", "go", 1)
8print(u)
9print(t)
10joined = "-".join(w.upper() for w in words if len(w) > 2)
11print(joined)
12name = "Kim"
13score = 87.456
14print(f"{name}:{score:.1f}점")
15print("%s-%03d" % (name, 7))

해설을 먼저 보면 이후 정답 시 점수가 50%만 반영됩니다.