Algorithm/Checkio

    [Checkio] Scientific Expedition. Sum by Type

    You have a list. Each value from that list can be either a string or an integer. Your task here is to return two values. The first one is a concatenation of all strings from the given list. The second one is a sum of all integers from the given list. Input: An array of strings ans integers Output: A list or tuple 1 2 3 4 5 6 7 8 9 def sum_by_types(items: list) -> Tuple[str, int]: ssum = 0 string..

    [Checkio] Electronic station. Surjection Strings

    [Checkio] Electronic station. Surjection Strings

    You need to check that the 2 given strings are isometric. This means that a character from one string can become a match for characters from another string. One character from one string can correspond only to one character from another string. Two or more characters of one string can correspond to one character of another string, but not vice versa. Input: Two arguments. Both strings. Output: B..

    [Checkio] Electronic station. Digits Multiplication

    You are given a positive integer. Your function should calculate the product of the digits excluding any zeroes. For example: The number given is 123405. The result will be 1*2*3*4*5=120 (don't forget to exclude zeroes). Input: A positive integer. Output: The product of the digits as an integer. - 0이 포함될 수 있는 양의 정수가 주어지고, 0을 제외한 나머지 숫자들을 모두 곱한 값을 구한다 1 2 3 4 5 6 7 8 9 10 def checkio(number: int)..

    [Checkio] HOME. Bigger Price

    Your mission here is to find the TOP most expensive goods. The amount we are looking for will be given as a first argument and the whole data as the second one Input: int and list of dicts. Each dicts has two keys "name" and "price" Output: the same as the second Input argument. - 입력받은 수 만큼 비싼 상품부터 출력 1 2 3 4 5 def bigger_price(limit: int, data: list) -> list: data = sorted(data, key = lambda x ..

    [Checkio] HOME. Sort Array by Element Frequency

    Sort the given iterable so that its elements end up in the decreasing frequency order, that is, the number of times they appear in elements. If two elements have the same frequency, they should end up in the same order as the first appearance in the iterable. Input: Iterable Output: Iterable Example: frequency_sort([4, 6, 2, 2, 6, 4, 4, 4]) == [4, 4, 4, 4, 6, 6, 2, 2] frequency_sort(['bob', 'bob..