본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 49

반응형

Q>

This is an intro mission, the purpose of which is to explain how to solve missions on CheckiO and how to get the most out of solving them.

(이것은 인트로 임무로서, CheckiO의 임무를 해결하는 방법과이를 해결하는 방법을 설명하는 것이 목적입니다.)

When the mission is solved, one more station become available for you, containing more complex missions.

(임무가 해결되면 더 복잡한 임무가 포함 된 하나의 역이 제공됩니다.)

So this mission is the easiest one.

(그래서이 임무는 가장 쉬운 것입니다.)

Write a function that will receive 2 numbers as input and it should return the multiplication of these 2 numbers.

(2 개의 숫자를 입력으로받을 함수를 작성하면이 2 개의 숫자의 곱셈을 리턴해야합니다.)

 

Input: Two arguments. Both are int(두 개의 인수. 둘 다 int입니다.)

 

Output: Int.(정수)

 

Example:

mult_two(2, 3) == 6
mult_two(1, 0) == 0

 

How does it work?:

When you start solving the initial code is always consists of an “empty” function (which you need to fill in as the solution) and asserts under this function.

(해결을 시작할 때 초기 코드는 항상 "빈"함수 (솔루션으로 채워야 함)로 구성되며이 함수로 선언됩니다.)

You should pay attention to is that your function should return values, and not to print them.

(주의 할 점은 함수가 값을 반환하고 인쇄하지 말아야한다는 것입니다.)

That is, use the return command instead of the print function.

(즉, print 함수 대신 return 명령을 사용하십시오.)

 

A>

def mult_two(a, b):
    mul = a * b
    return mul


if __name__ == '__main__':
    print("Example:")
    print(mult_two(3, 2))

    # These "asserts" are used for self-checking and not for an auto-testing
    assert mult_two(3, 2) == 6
    assert mult_two(1, 0) == 0
    print("Coding complete? Click 'Check' to earn cool rewards!")

 

O>

Example:
6
Coding complete? Click 'Check' to earn cool rewards!

Process finished with exit code 0

 

S>

https://py.checkio.org/

반응형

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

Python Learn the basics Quiz 51  (0) 2019.06.11
Python Learn the basics Quiz 50  (0) 2019.06.10
Python Learn the basics Quiz 48  (0) 2019.06.10
Python Learn the basics Quiz 47  (0) 2019.06.10
Python Learn the basics Quiz 46  (0) 2019.06.10