随笔分类 -  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 阅读全文
posted @ 2020-07-11 23:25 AdyB 阅读(132) 评论(0) 推荐(0)
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 阅读全文
posted @ 2020-06-28 05:09 AdyB 阅读(223) 评论(0) 推荐(0)
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 阅读全文
posted @ 2020-06-26 03:44 AdyB 阅读(59) 评论(0) 推荐(0)
2020.4.19 练习
摘要:1. 创建一个函数,该函数返回两个战斗机之间的战斗中获胜者的名字。 每个战斗机轮流攻击对方,而首先杀死对方的人是胜利的。死亡被定义为具有health <= 0。 每个战斗机将是一个Fighter对象/实例。请以您选择的语言查看下面的Fighter类。 这两个health和damagePerAttac 阅读全文
posted @ 2020-04-20 03:35 AdyB 阅读(173) 评论(0) 推荐(0)
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: 阅读全文
posted @ 2020-04-20 02:52 AdyB 阅读(125) 评论(0) 推荐(0)
day 1 练习
摘要:1. Implement a function that adds two numbers together and returns their sum in binary. The conversion can be done before, or after the addition. def 阅读全文
posted @ 2020-04-19 00:50 AdyB 阅读(167) 评论(0) 推荐(0)