- 博客(16)
- 收藏
- 关注
原创 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 270
原创 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 302
原创 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 231
原创 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 244 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 138
原创 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 369
原创 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 154
原创 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 159
原创 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 181
原创 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 209
原创 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 242
原创 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 304
原创 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 364
原创 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 332
原创 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 77
原创 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 106
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人