본문 바로가기

Python_Matter/[Check_IO]Elementary

(19)
Elementary Map Before a big journey begins, let's warmup a bit. Some very simple missions will help you remember how to use code as well as how CheckiO works. Don’t forget to check out the solutions of other users. Those are the best! Multiply(Intro) https://py.checkio.org/en/mission/multiply-intro https://developer-ankiwoong.tistory.com/853 Easy Unpack https://py.checkio.org/en/mission/easy-unpack https://dev..
Between Markers Quiz> You are given a string and two markers (the initial one and final). You have to find a substring enclosed between these two markers. But there are a few important conditions. This is a simplified version of the Between Markers mission. The initial and final markers are always different. The initial and final markers are always 1 char size. The initial and final markers always exist in a st..
Nearest Value Quiz> Find the nearest value to the given one. You are given a list of values as set form and a value for which you need to find the nearest one. For example, we have the following set of numbers: 4, 7, 10, 11, 12, 17, and we need to find the nearest value to the number 9. If we sort this set in the ascending order, then to the left of number 9 will be number 7 and to the right - will be number ..
Beginning Zeros Quiz> You have a string that consist only of digits. You need to find how many zero digits ("0") are at the beginning of the given string. Input: A string, that consist of digits. Output: An Int. Example: beginning_zeros('100') == 0 beginning_zeros('001') == 2 beginning_zeros('100100') == 0 beginning_zeros('001001') == 2 beginning_zeros('012345679') == 1 beginning_zeros('0000') == 4 Precondition..
Split Pairs Quiz> Split the string into pairs of two characters. If the string contains an odd number of characters, then the missing second character of the final pair should be replaced with an underscore ('_'). Input: A string. Output: An iterable of strings. Example: split_pairs('abcd') == ['ab', 'cd'] split_pairs('abc') == ['ab', 'c_'] Precondition: 0 1. a의 문자의 갯수를 변수에 할당한다. def split_pairs2(a): len_sp..
Max Digit Quiz> You have a number and you need to determine which digit in this number is the biggest. Input: A positive int. Output: An Int (0-9). Example: max_digit(0) == 0 max_digit(52) == 5 max_digit(634) == 6 max_digit(1) == 1 max_digit(10000) == 1 def max_digit(number: int) -> int: # your code here return 0 if __name__ == '__main__': print("Example:") print(max_digit(0)) # These "asserts" are used f..
Replace First Quiz> In a given list the first element should become the last one. An empty list or list with only one element should stay the same. example Input: List. Output: Iterable. Example: replace_first([1, 2, 3, 4]) == [2, 3, 4, 1] replace_first([1]) == [1] from typing import Iterable def replace_first(items: list) -> Iterable: # your code here return items if __name__ == '__main__': print("Example:")..
Remove All Before Quiz> Not all of the elements are important. What you need to do here is to remove from the list all of the elements before the given one. example For the illustration we have a list [3, 4, 5] and we need to remove all elements that go before 3 - which is 1 and 2. We have two edge cases here: (1) if a cutting element cannot be found, then the list shoudn't be changed. (2) if the list is empty, t..