728x90
n this mission you should write a function that introduces a person with the given parameter's attributes.
Input: Two arguments. String and positive integer.
Output: String.
Example:
say_hi("Alex", 32) == "Hi. My name is Alex and I'm 32 years old"
say_hi("Frank", 68) == "Hi. My name is Frank and I'm 68 years old"
- 풀이
def say_hi(name: str, age: int):
s_age = str(age)
return "Hi. My name is "+ name + " and I'm " + s_age + " years old"
- 다른 풀이
def say_hi(name: str, age: int) -> str:
return "Hi. My name is {} and I'm {} years old".format(name, age)
반응형
'취미생활 > CheckIO' 카테고리의 다른 글
[checkIO]Element 03.Index Power (0) | 2020.02.24 |
---|---|
[checkIO]Element 02.Easy Unpack (0) | 2020.02.22 |
[checkIO]Home 12.Xs and Os Referee (0) | 2020.02.19 |
[checkIO]Home 11.Bird Language (0) | 2020.02.17 |
[checkIO]Home 10.Sun Angle (0) | 2020.02.17 |