티스토리 뷰

728x90

What's Your Name?

You are given the firstname and lastname of a person on two different lines. Your task is to read them and print the following:

Hello firstname lastname! You just delved into python.

Function Description

Complete the print_full_name function in the editor below.

print_full_name has the following parameters:

  • string first: the first name
  • string last: the last name

Prints

  • string: 'Hello firstname lastname! You just delved into python' where firstname and lastname are replaced with first and last.

Input Format

The first line contains the first name, and the second line contains the last name.

Constraints

The length of the first and last names are each ≤ 10.

Sample Input 0

Ross
Taylor

Sample Output 0

Hello Ross Taylor! You just delved into python.

Explanation 0

The input read by the program is stored as a string data type. A string is a collection of characters.

 

문제해석

input으로 firstname과 lastname이 다른 라인으로 입력된다. 이 이름을 읽어서 아래와 같은 포맷으로 출력하면 된다.

Hello firstname lastname! You just delved into python.

 

문제풀이

친절하게 first, last 인자를 받아서 함수까지 만들어져 있으므로, 단순히 두 값을 받아서 format()함수를 사용하여 출력하면 된다.

def print_full_name(first, last):
    # Write your code here
    print("Hello {0} {1}! You just delved into python.".format(first, last))

if __name__ == '__main__':
    first_name = raw_input()
    last_name = raw_input()
    print_full_name(first_name, last_name)
728x90
LIST
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함