by Harrison Feng in Python 无论是range()还是xrange()都是Python里的内置函数.这个两个内置函数最常用在for循环中.例如: >>> for i in range(5): ... print i ... 0 1 2 3 4 >>> for i in xrange(5): ... print i ... 0 1 2 3 4 >>> range()和xrange() 在Python 2里是两种不同的实现.但是在P…
题目链接: 题目 I. Approximating a Constant Range time limit per test:2 seconds memory limit per test:256 megabytes 问题描述 When Xellos was doing a practice course in university, he once had to measure the intensity of an effect that slowly approached equilibr…
题目(1)for i in range(10): print(i) 结果:123456789 题目(2) for lst in range(100): if lst % 7 == 0 and str(7) in str(lst): print(int(lst) 解释: 这里的"%"表示取余的意思,range里的数一个个给lst, lst % 7 == 0, 如果就是取余7 ,我把他理解为7的倍数,后面的 str(7) in str(lst), 如果字符串lst里带有7,就打印出来, i…