摘要:
Solition: def number(bus_stops): return sum([i[0] - i[1] for i in bus_stops]) def number(bus_stops): return sum(on - off for on, off in bus_stops) 阅读全文
摘要:
描述: 你的函数有两个参数: 当前父亲的年龄(岁) 儿子现在的年龄(岁) 计算多少年前父亲的年龄是儿子的两倍(或多少年后他将是儿子的两倍)。 Solution: def twice_as_old(f, s): return abs(f - s * 2) :abs(x) 取数值绝对值 阅读全文
摘要:
DESCRIPTION: Who remembers back to their time in the schoolyard, when girls would take a flower and tear its petals, saying each of the following phra 阅读全文
摘要:
Exercise: 给定一个由 1 和 0 组成的数组,将等效的二进制值转换为整数。 例如:[0, 0, 0, 1]被视为是0001的二进制==>1。 例子: Testing: [0, 0, 0, 1] ==> 1 Testing: [0, 0, 1, 0] ==> 2 Testing: [0, 1 阅读全文