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 ...
随机推荐
- buuctf@easyre
- dede cms 怎样调用年月日
一: 首页:([field:pubdate function='strftime("%m-%d",@me)'/])==(5-15)([field:pubdate function= ...
- hdu 2604 Queuing(推推推公式+矩阵快速幂)
Description Queues and Priority Queues are data structures which are known to most computer scientis ...
- java支持断点续传文件上传和下载组件
java两台服务器之间,大文件上传(续传),采用了Socket通信机制以及JavaIO流两个技术点,具体思路如下: 实现思路: 1.服:利用ServerSocket搭建服务器,开启相应端口,进行长连接 ...
- sql in条件 超过1000字符的处理方法
private string getOracleSQLIn(string[] ids, string field) { int count = Math.Min(ids.Length, 1000); ...
- RedHat6.2系统安装ipvsadm+keepalived
一.安装IPVS 软件包下载: 链接:https://pan.baidu.com/s/1zNgPtALbdBTC1H6e0IaZPw 提取码:xm7t 1.检查内核模块,看一下ip_vs 是否被加载 ...
- MongoDB下载以及安装
一.下载与安装 1.安装Mongo MongoDB下载地址:https://www.mongodb.com/download-center?jmp=tutorials#community 运行安装程序 ...
- @ControllerAdvice 全局异常处理
使用@ControllerAdvice 定义 全局异常处理 package com.app; import java.io.IOException; import java.io.PrintWrite ...
- Zookeeper入门(六)之zkCli.sh对节点的增删改查
参考地址为:https://www.cnblogs.com/sherrykid/p/5813148.html 1.连接 在 bin 目录下的 zkCli.sh 就是ZooKeeper客户端 ./z ...
- linux 系统的 cache 过大,解决方案
linux buff/cache过大,清理脚本 2018年06月20日 13:44:53 taozhe666 阅读数:6500 三条指令: sync echo 1 > /proc/sys/v ...