懵懂音响

文章
9
资源
0
加入时间
3年1月7天

Large Division LightOJ - 1214

Given two integers, a and b, you should check whether a is divisible by b or not. We know that an integer a is divisible by an integer b if and only if there exists an integer c such that a = b * c....

(第5天)5.2 设置循环次数:for +range 句式 

(1)循环10次前面我们通过for句式循环输出列表的内容为例,讲解了循环控制的使用方法。但有时我们并不想循环输出列表的内容,而是想指定循环的次数,重复执行特定的任务,比如打印输出100张宣传单等等。方法很简单,还是在前面for句式的基础上,将“列表”换成“range(循环次数)”,如下图所示。比如range(5),它表示的含义是循环5次,循环次序从0开始,实际上,range(5),就相当于一个[0,1,2,3,4]的列表。上面的代码可以解读如下:仔细观察下面的代码,学习f...