본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 38

반응형

Q>

We have prepared a set of Editor's Choice Solutions. You will see them first after you solve the mission. In order to see all other solutions you should change the filter.

(우리는 Editor 's Choice Solutions 세트를 준비했습니다. 선교사를 해결 한 후에 그들을 먼저 볼 것입니다. 다른 모든 솔루션을 보려면 필터를 변경해야합니다.)

In this mission you should write a function that introduce a person with a given parameters in 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"


A>

# 1. on CheckiO your solution should be a function
# 2. the function should return the right answer, not print it.

def say_hi(name: str, age: int) -> str:
"""
Hi!
"""
# your code here
# 문자열과 정수를 받는 함수를 받아 문자열로 리턴 해주는 함수를 작성하시오.
return "Hi. My name is {} and I'm {} years old".format(name, age)

if __name__ == '__main__':
#These "asserts" using only for self-checking and not necessary for auto-testing
assert say_hi("Alex", 32) == "Hi. My name is Alex and I'm 32 years old", "First"
assert say_hi("Frank", 68) == "Hi. My name is Frank and I'm 68 years old", "Second"
print('Done. Time to Check.')


O>

Hi. My name is ankiwoong and I'm 35 years old


Process finished with exit code 0


S>

https://py.checkio.org

반응형

'Python_Matter > Solve' 카테고리의 다른 글

Python Learn the basics Quiz 40  (0) 2019.06.08
Python Learn the basics Quiz 39  (0) 2019.06.08
Python Learn the basics Quiz 38  (0) 2019.06.08
Python Learn the basics Quiz 37  (0) 2019.06.07
Python Learn the basics Quiz 36  (0) 2019.06.07
Python Learn the basics Quiz 35  (0) 2019.05.25