나는 이렇게 학습한다/Algorithm & SQL

1102. Welcome to the City

daco2020 2022. 11. 2. 22:31
반응형

Create a method sayHello/say_hello/SayHello that takes as input a name, city, and state to welcome a person. Note that name will be an array consisting of one or more values that should be joined together with one space between each, and the length of the name array in test cases will vary.

Example:

say_hello(['John', 'Smith'], 'Phoenix', 'Arizona')

This example will return the string Hello, John Smith! Welcome to Phoenix, Arizona!



Solution:

def say_hello(name, city, state):
    return f"Hello, {' '.join(name)}! Welcome to {city}, {state}!"


반응형

'나는 이렇게 학습한다 > Algorithm & SQL' 카테고리의 다른 글

1104. Sum Mixed Array  (0) 2022.11.04
1103. Welcome!  (0) 2022.11.04
1101. Fix your code before the garden dies!  (0) 2022.11.01
1031. Vowel remover  (0) 2022.10.31
1030. How many stairs will Suzuki climb in 20 years?  (0) 2022.10.30