210726 TIL

오늘의 진도

<비전공자가 궁금해하는 프로그래머 첫걸음> ~126p (1-5 문자열 조작)


배운 점

  1. format 메서드

ex)

 n1 = input("Enter a noun:")
 v = input("Enter a verb:")
 adj = input("Enter an adj:")
 n2 = input("Enter a noun")
 
 result = "The {} {} the {} {}".format(n1, v, adj, n2)
 print(r)
  1. join 메서드

ex)

 words = ["This", "is", "an", "example."]
 result = " ".join(words)
 print(result)

태그:

카테고리:

업데이트: