for循环实现九九乘法表
<!--for循环实现九九乘法表-->
<table border="">
<tbody>
{% for x in range(1,10) %}
<tr>
{% for y in range(1,x + 1) %}
<td>
{{ y }} * {{ x }} = {{ y * x }}
</td>
{% endfor %} </tr>
{% endfor %}
</tbody>
</table>
<!--for循环的另一种实现-->
<table border="">
<tbody>
{% for x in range(1,10) %}
<tr>
<!--for模板中不能用continue和break-->
<!--但是可以加 if条件实现同样的功能-->
{% for y in range(1,10) if y <= x %}
<!--if 条件为false,循环退出-->
<td>
{{ y }} * {{ x }} = {{ y * x }}
</td>
{% endfor %} </tr>
{% endfor %}
</tbody>
</table>

for循环实现九九乘法表的更多相关文章
- For循环输出九九乘法表
题:使用For循环输出九九乘法表 解析: 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 .... 1*9=9 ........ .....9*9=81 可以看做j*i ...
- 写一个方法,用一个for循环打印九九乘法表
public class MultiplicationTable { /** * @description 写一个方法,用一个for循环打印九九乘法表 * @author wangkun * ...
- 用JS的for循环打印九九乘法表
需要使用两个for循环嵌套,代码如下: <!DOCTYPE html> <html lang="en"> <head> <meta cha ...
- day4(分支结构,循环结构,for循环,九九乘法表)
一:复习 ''' 1.变量名命名规范 -- 1.只能由数字.字母 及 _ 组成 -- 2.不能以数字开头 -- 3.不能与系统关键字重名 -- 4._开头有特殊含义 -- 5.__开头__结尾的变量, ...
- 简单的for循环实现九九乘法表
PHP for 循环 语法 for (init counter; test counter; increment counter) { code to be executed; } 参数: init ...
- Java-for循环打印九九乘法表
Java打印九九乘法表 public class forDemo04 { public static void main(String[] args) { //练习3:打印九九乘法表 /* 1*1=1 ...
- for循环打印九九乘法表
学习目标: 熟练掌握 for 循环的使用 例题: 需求:打印九九乘法表 代码如下: // 九九乘法表 // row 为行,col为列 for(int row = 1; row < 10; row ...
- For循环案例---九九乘法表
概述:先创建一个Print99类,类中创建5个方法,分别为Test9901.Test9902.Test9903.Test9904.Test9905,分别打印出不同形状的九九乘法表,该类创建完成后再创建 ...
- JS-用js的for循环实现九九乘法表以及其他算数题等
<!DOCTYPE html><html> <head> <meta charset="utf-8"> <title>f ...
随机推荐
- puppet集群
实验目的: 由于现有的环境中,puppetmaster是单节点,客户端更新时出现了更新失败和时间较长等现象.考虑将puppetmaster做成集群的模式,解决大量客户端更新延时和单节点故 ...
- Discuz升级
1.下载论坛程序文件 2.备份数据库 3.建立文件夹 old,旧程序除了 data , config, uc_client, uc_server 目录以外的程序移动进入 old目录中4. 上传 u ...
- sklearn学习一
转发说明:by majunman from HIT email:2192483210@qq.com 简介:scikit-learn是数据挖掘和数据分析的有效工具,它建立在 NumPy, S ...
- 【leetcode】1244. Design A Leaderboard
题目如下: Design a Leaderboard class, which has 3 functions: addScore(playerId, score): Update the leade ...
- k8s-强制删除pod
kubectl get deployments --all-namespaces [root@master ~]# kubectl get deployments --all-namespacesNA ...
- 总结JavaScript中浏览器的兼容问题
浅析JavaScript中浏览器的兼容问题 浏览器兼容性问题是在实际开发中容易忽略而又最重要的一部分.我们在讲老版本浏览器兼容问题之前,首先要了解什么是能力检测,它是来检测浏览器有没有这种能力,即判断 ...
- BZOJ 1212: [HNOI2004]L语言 trie
长度小于 10 是关键信息~ #include <cstdio> #include <cstring> #include <algorithm> #define N ...
- 杜教筛&min_25筛复习
杜教筛 适用条件 你要能构造出\(g(x),h(x)\),使得\(h=f*g\). \(G(x),H(x)\)的值可以快速计算. 过程 我们要求的是\(F(n)=\sum_{i=1}^{n}f(i)\ ...
- 关于Jdk7与Jdk8对Collections进行分组的区别
先准备一点数据: public class User { private Integer id; private String type; private String name; ...
- gherkin
语法 The primary keywords are: Feature Rule (as of Gherkin 6) Scenario (or Example) Given, When, Then, ...