숫자와 마찬가지로 string 도 더할 수 있다.
이를 string concatenation 이라고 한다.
2개 혹은 그 이상의 문자열들을 잇는걸 뜻합니다.
예시)
print("Hello, " + "World")
string concatenation 은 언제 사용하면 좋을까?
특정 문자열만 변수에 저장되어 있을 때 사용하면 편리하다.
예시)
name = input()
print("Hello, " + name)
만일 "jake" 란 값이 input으로 입력되면 "Hello, jake" 가 출력이 된다.
name = input() print(f"Hello, {name}")
문법 :
예시)
date = 1980 python_inventor = "Guido van Rossum" location = "Centrum Wiskunde & Informatica" country = "Netherlands" print(f"""Python was conceived in the late {date}s by {python_inventor} at {location} (CWI) in the {country} as a successor to the ABC language (itself inspired by SETL), capable of exception handling and interfacing with the Amoeba operating system. Its implementation began in December 1989.""")