티스토리 뷰
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)
'Programming > Python' 카테고리의 다른 글
[Python/Hackerrank] Strings > Find a string (0) | 2021.12.08 |
---|---|
[Python/Hackerrank] Strings > Mutations (0) | 2021.12.08 |
[Python/Hackerrank] Strings > String Split and Join (0) | 2021.12.08 |
[Python/Hackerrank] Strings > sWAP cASE (0) | 2021.12.08 |
[Python/Hackerrank] Basic Data Types > Tuples (0) | 2021.12.08 |
- Total
- Today
- Yesterday
- mysql
- 몰누피라비르
- 넥스트BT
- HK이노엔
- TSQL
- string
- 매매일지
- 에코캡
- 넷플릭스
- 동국알앤에스
- SQL Server
- insert
- tensorflow
- 분석탭
- 코로나19
- Weather Observation Station
- hackerrank
- Tableau
- DATABASE
- MS SQL Server
- 미중무역전쟁
- 대원화성
- MSSQL
- 테슬라
- 경구치료제
- python3
- python
- 해커랭크
- list
- 리비안
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |