11
wusuozhusheng
1 6 15
570/ 645
Last seen 4 months ago
Member for 6 months, 4 days
Difficulty Easy
Best reviews / Newest reviews
First-wusuozhusheng
def first_word(text: str) -> str: # your code here return text.partition(' ')[0] More
First-wusuozhusheng
# your code here ''' 找出字符串中不重复得最长子字符串长度。 指针法,定义起始,结束指针,结束指针循环字符串长度 ''' re = 0 start = 0; end = 1 ls = len(s) while end <= ls: if end == ls: re = len(s[start: end]) if len(s[start: end]) > re else re elif s[end] in s[start: end]: More
First-wusuozhusheng
def max_digit(value: int) -> int: # your code here sv = str(value) lis = [eval(i) for i in sv] return max(lis) More
First-wusuozhusheng
def sum_numbers(text: str) -> int: # your code here stex = str(text) sl = stex.split() dl = list() for word in sl: if word.isdecimal(): dl.append(eval(word)) return sum(dl) More
First-wusuozhusheng
def index_power(ar: list[int], n: int) -> int: # your code here try: v = ar[n] re = v ** n except IndexError: re = -1 return re More
First-wusuozhusheng
这种做法的通用性更强。列表List中的元素不管是否HASHABLE都可以用。 More
First-wusuozhusheng
def goes_after(word: str, first: str, second: str) -> bool: # your code here a = first in word b = second in word c = first != second re = False if a * b * c: ww = first + second ind = min(word.index(first), word.index(second)-1) re = True if ww == wo More
First-wusuozhusheng
def translate(text: str) -> str: # your code here re = list() yuany = 'aeiouy' tl = text.split() for word in tl: w = str() poi = 0 while poi < len(word): if word[poi] in yuany: nexp = poi + 3 else: n More
First-wusuozhusheng
def end_zeros(a: int) -> int: # your code here sa = str(a) p = -1 re = 0 while True: try: if sa[p] == '0': re += 1 else: break except IndexError: break p -= 1 return re More
First-wusuozhusheng
for cha in name: if cha.isupper() and con: re += '_' + cha else: re += cha con += 1 re = re.lower() return re More
First-wusuozhusheng
def to_camel_case(name: str) -> str: # replace this for solution re = str() nali = name.split('_') for word in nali: re += word.title() return re More
First-wusuozhusheng
def checkio(text: str) -> str: # your code here fre_dic = dict() alpha = 'abcdefghijklmnopqrstuvwxyz' text = text.lower() for ch in text: if ch in alpha: fre_dic[ch] = fre_dic.get(ch, 0) + 1 re = str() for tup in fre_dic.items(): if More
First-wusuozhusheng
def cut_sentence(line: str, length: int) -> str: # your code here re = str() line = line.rstrip() jud = line[length: length+1] if not jud: re = line elif jud.isspace(): re = line[:length].rstrip() + '...' else: while line[length: length+1] and not More