CheckiO_Elementary
文章平均质量分 57
题目均来自于py.CheckiO中的Elementary小岛,用于记录自己的解题思路和其他用户的解决方案。
this_is_GQ
这个作者很懒,什么都没留下…
展开
-
Is Even
问题描述:Check if the given number is even or not. Your function should return True if the number is even, and False if the number is odd.Input:An int.Output:A bool.def is_even(num: int) -> bool: # your code here return Falseif __na...原创 2021-08-13 18:12:00 · 294 阅读 · 0 评论 -
Correct Sentence
问题描述:For the input of your function, you will be given one sentence. You have to return a corrected version, that starts with a capital letter and ends with a period (dot).Pay attention to the fact that not all of the fixes are necessary. If a senten..原创 2021-08-12 23:35:31 · 337 阅读 · 0 评论 -
Between Markers (simplified)
问题描述: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 Markersmission.The init...原创 2021-08-12 06:37:02 · 252 阅读 · 0 评论 -
Nearest Value
问题描述: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 ...原创 2021-08-11 06:07:20 · 285 阅读 · 1 评论 -
Beginning Zeros
问题描述: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.(一共有多少个0在字符串前面)Input:A string, that consist of digits.Output:An Int.def beginning_zeros(number: str) ->...原创 2021-08-09 21:45:48 · 150 阅读 · 0 评论 -
Split Pairs
问题描述: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....原创 2021-08-08 05:04:57 · 399 阅读 · 0 评论 -
Max Digit
问题描述: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).def max_digit(number: int) -> int: # your code here return 0if __name__ == '__main__': print(...原创 2021-08-07 23:53:20 · 174 阅读 · 0 评论 -
Replace First
问题描述: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.Input:List.Output:Iterable.from typing import Iterabledef replace_first(items: list) -> Iterable: ...原创 2021-08-07 07:25:57 · 170 阅读 · 0 评论 -
All Upper I
问题描述:Check if a given string has all symbols in upper case. If the string is empty or doesn't have any letter in it - function should return True.Input:A string.Output:a boolean.def is_all_upper(text: str) -> bool: # your code here ...原创 2021-07-16 18:08:03 · 120 阅读 · 0 评论 -
Remove All Before
问题描述: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.For the illustration we have a list [1, 2, 3, 4, 5] and we need to remove all elements that go before 3 - whic...原创 2021-08-02 02:50:38 · 192 阅读 · 0 评论 -
Backward String
问题描述:You should return a given string in reverse order.Input:A string.Output:A string.def backward_string(val: str) -> str: # your code here return Noneif __name__ == '__main__': print("Example:") print(backward_string('v...原创 2021-07-29 23:46:53 · 219 阅读 · 0 评论 -
End Zeros
问题描述:Try to find out how many zeros a given number has at the end.Input:A positive IntOutput:An Int.def end_zeros(num: int) -> int: # your code here return Noneif __name__ == '__main__': print("Example:") print(end_zeros(...原创 2021-07-29 05:47:56 · 256 阅读 · 0 评论 -
Number Length
问题描述:You have a positive integer(整数). Try to find out how many digits it has?(有多少个数字?)Input:A positive IntOutput:An Int.def number_length(a: int) -> int: # your code here return Noneif __name__ == '__main__': print("Example:"...原创 2021-07-29 04:20:03 · 329 阅读 · 0 评论 -
Acceptable Password I
问题描述:You are at the beginning of a password series. Every mission is based on the previous one. The missions that follow will become slightly more complex.In this mission, you need to create a password verification function.The verification condit...原创 2021-07-21 03:11:05 · 377 阅读 · 0 评论 -
First Word (simplified)
问题描述:You are given a string and you have to find its first word.This is a simplified version of the First Word mission, which can be solved later.The input string consists of only English letters and spaces.(输入字符串仅由英文字母和空格组成) There aren’t any spa...原创 2021-07-20 03:55:28 · 357 阅读 · 0 评论 -
Easy Unpack
问题描述:Input:A tuple, at least 3 elements long.Output:A tuple.def easy_unpack(elements: tuple) -> tuple: """ returns a tuple with 3 elements - first, third and second to the last """ # your code here return ()if __na...原创 2021-07-18 19:36:39 · 93 阅读 · 0 评论