随笔分类 - python 练习
python 7.11 练习
摘要:1. 返回列表中出现最多的数字, 如果出现的次数一样多,返回数值大的那个 def highest_rank(arr): a = max([arr.count(i) for i in arr]) b = set() for i in arr: if arr.count(i) == a: b.add(i
阅读全文
2020.06.27
摘要:1. Your goal in this kata is to implement a difference function, which subtracts one list from another and returns the result. It should remove all va
阅读全文
2020.6.25 练习 (python)
摘要:1. 枚举的运用 Your team is writing a fancy new text editor and you've been tasked with implementing the line numbering. Write a function which takes a list
阅读全文
2020.4.19 练习
摘要:1. 创建一个函数,该函数返回两个战斗机之间的战斗中获胜者的名字。 每个战斗机轮流攻击对方,而首先杀死对方的人是胜利的。死亡被定义为具有health <= 0。 每个战斗机将是一个Fighter对象/实例。请以您选择的语言查看下面的Fighter类。 这两个health和damagePerAttac
阅读全文
day2 练习
摘要:1. 数不属于a-m 的字母,并返回个数/ 总字母个数 mein: 应该为109 不是110 def printer_error(s): a = 0 for i in s: if ord(i) >110: # a = a + 1 return str(a)+'/'+str(len(s)) key:
阅读全文
浙公网安备 33010602011771号