1. 斐波那契 from itertools import islice def fib(): a, b = 0, 1 while True: yield a a, b = b, a+b print list(islice(fib(), 5)) # [0, 1, 1, 2, 3] 2. for……else……用法(以查找素数为例) 正常版本: 1 def print_prime(n): 2 for i in xrange(2, n): 3 found = True 4 for j in xran
Problem: s0 = "a", s1 = "b", s2 = "ba", s3 = "bab", s4 = "babba", s4 = "babbabab", is called Fibonacci string. For the string with index n, given a string str = "bb", calculate how man
今天在园子里看到个group by 分组多列统计的例子,转走给大家分享一下: create table tests (year datetime year to year,type char(1),value int);alter table tests alter colomn year int; insert into tests values (2015,1,100);insert into tests values (2015,2,200);insert into tests value