본문 바로가기

Python_Matter/Solve

Python Learn the basics Quiz 99

반응형

Q>

We have an array of two positive integers.

(우리는 두 개의 양의 정수 배열을 가지고 있습니다.)

Add these two numbers together.

(이 두 숫자를 합치십시오.)

 

Input: A list of two elements. Each element is a positive integer.

         (두 요소의 목록입니다. 각 요소는 양의 정수입니다.)

 

Output: The sum of two numbers.

            (두 숫자의 합입니다.)

 

Example:

checkio([5, 5]) == 10
checkio([7, 1]) == 8
checkio([5, 5]) == 10

 

A>

def checkio(data):
    """The sum of two integer elements"""
    return sum(data)


if __name__ == '__main__':
    assert checkio([5, 5]) == 10, 'First'
    assert checkio([7, 1]) == 8, 'Second'
    print('All ok')

 

O>

All ok

Process finished with exit code 0

 

S>

https://py.checkio.org

반응형

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

Python Learn the basics Quiz 101  (0) 2019.06.25
Python Learn the basics Quiz 100  (0) 2019.06.25
Python Learn the basics Quiz 98  (0) 2019.06.25
Python Learn the basics Quiz 97  (0) 2019.06.24
Python Learn the basics Quiz 96  (0) 2019.06.24