Github base demo
Posted libragyf
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Github base demo相关的知识,希望对你有一定的参考价值。
""" 01 有如下值集合 [11,22,33,44,55,66,77,88,99,90],将所有大于 66 的值保存至字典的第一个key中,将小于 66 的值保存至第二个 key的值中。即: {‘k1‘: 大于66的所有值, ‘k2‘: 小于66的所有值}""" def demo_1(n): k1 = [] k2 = [] dic ={‘k1‘:k1,‘k2‘:k2} for i in n: if i >66: k1.append(i) else: k2.append(i) return dic print(demo_1([11,22,33,44,55,66,77,88,99,90]))
""" 02 查找列表中元素,移除每个元素的空格,并查找以 a或A开头 并且以 c 结尾的所有元素。""" li = ["alec", " aric", "Alex", "Tony", "rain"] tu = ("alec", "aric", "Alex", "Tony", "rain") def demo_1(n): x = [] y = [] ret = {‘移除每个元素的空格后‘: x, ‘以a或A开头并且以c结尾的元素‘: y} for i in n: a = i.strip() x.append(a) if (a.find(‘a‘) == 0 or a.find(‘A‘) == 0) and a.endswith(‘c‘) == True: y.append(a) return ret print(demo_1(li)) #------------------------------------------------------------------------ dic = {‘k1‘: "alex", ‘k2‘: ‘ aric‘, "k3": "Alex", "k4": "Tony"} def demo_2(n): x = [] y = [] ret = {‘移除每个元素的空格后‘: x, ‘以a或A开头并且以c结尾的元素‘: y} for i in n.values(): a = i.strip() x.append(a) if (a.find(‘a‘) == 0 or a.find(‘A‘) == 0) and a.endswith(‘c‘) == True: y.append(a) return ret print(demo_2(dic))
以上是关于Github base demo的主要内容,如果未能解决你的问题,请参考以下文章
read ECONNRESET at TLSWrap.onStreamRead (internal/stream_base_commons.js:209:20) { errno: -4077(代码片段
[vscode]--HTML代码片段(基础版,reactvuejquery)
[Codeforces Round #522 (Div. 2, based on Technocup 2019 Elimination Round 3)][C. Playing Piano](代码片段
java.util.MissingResourceException: Can't find bundle for base name init, locale zh_CN问题的处理(代码片段