# 打印#做出@列的效果
height = int(input("height: ")) #用户输入一个高度

num_height = height
while num_height > 0:
  print("@")
  num_height -= 1

# 打印#做出@列的效果
width = int(input("width: ")) #用户输入一个宽度

num_width = 1 #第一步 赋值
while num_width <= width: #第二步 num_width == 1
  print("#",end="") #第三步 不换行 打印一个#
  num_width += 1 #第四步 num_width == 2
print()

# 打印#做出N行X列的效果
height = int(input("height: ")) #用户输入一个高度
width = int(input("width: ")) #用户输入一个宽度

num_height = 1
while num_height <= height:
  num_width = 1
  while num_width <= width:
    print("#",end="")
    num_width += 1
  print()  
  num_height += 1

通过前面的铺垫,现在开始尝试打印九九乘法表

#九九乘法表
first = 1
while first <=9:
  second = 1
  while second <= first:
    print(str(second)+"*"+str(first)+"="+str(second*first),end="\t")
    second +=1
  first +=1
  print()

通过while循环一步步实现九九乘法表的更多相关文章

  1. 编写Java程序,使用循环结构打印出九九乘法表

    编写Java程序,使用循环结构打印出九九乘法表 效果如下: 实现代码: public class Multiplication99 { public static void main(String[] ...

  2. python—用for循环、while循环和一句话打印九九乘法表

    用for循环打印九九乘法表: for i in range (1,10): for j in range(1,10): print(j,"x",i,"=",i* ...

  3. Oracle三种循环例题:打印九九乘法表

    数据库SQL三种循环语句(For.While.Loop) --如果要将执行结果输出,需要先执行 setserveroutput on 命令,在窗口里显示服务器输出信息 set serveroutput ...

  4. For 循环的嵌套与九九乘法表

    ㈠通过程序,在页面中输入如下图形 * * * * * * * * * * * * * * * * * * * * * * * * *  代码如下: //向body中输入一个内容 //document. ...

  5. C语言for 循环 9*9 实现九九乘法表

    #include <stdio.h> int main(void) { //for循环实现9*9乘法表 /* 1*1=1 1*2=2 2*2=4 1*3=3 2*3=6 3*3=9 */ ...

  6. 利用js的for循环实现一个简单的“九九乘法表”

    For循环九九乘法表 for循环是javascript中一种常用的循环语句,可以很好的解决在程序中需要重复执行某些语句,利用for循环实现简单的“九九乘法表”的效果: 让循环从小到大,依次排序,并计算 ...

  7. Python中的九九乘法表(for循环)

    用for循环写出的九九乘法表(包括函数的调用) #方向一 for i in range(1,10):    for j in range(1,i+1):        d = i * j        ...

  8. 用for; while...do; do...while; 写出九九乘法表

    <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...

  9. 【Java】Java_15 打印九九乘法表

    使用For循环嵌套即可打印九九乘法表 以下是具体代码: /** * 打印九九乘法表 */ package com.oliver.test; public class TestMultiplicatio ...

随机推荐

  1. 【MAVEN】maven项目下载更新pom jar包速度慢 解决方案

    1·下载安装 最新版本的maven https://maven.apache.org/download.cgi 2·速度慢的主要原因是因为默认setting.xml里配置的国外的 maven 数据源 ...

  2. Python基础_ONLINE习题集_03 数据类型

    3.1 将元组(1,2,3) 和集合{"four",5,6}合成一个列表 tuple,set,list = (1,2,3),{"four",5,6},[] fo ...

  3. JavaWeb开发:从购买服务器到简单demo运行

    写这篇文章的目的: 一个是为了记录实施过程,方便自己日后查阅: 另一个是给项目组成员提供一个参考,方便他们以后搭建自己的项目环境: 当然若能帮助到更多的朋友,那就再好不过了:D 需要注意: 我本身也是 ...

  4. java string常用的占位符形式

        自己在这里总结了三种占位符形式:看下面代码即可 String stringFormat  = "lexical error at position %s, encountered % ...

  5. 装系统:Win7,机子是Dell 5460,有半高的mSATA SSD

    问题描述:Dell Vostro 5460有一个机械盘,有一个半高的mSATA SSD,现在想将系统重装到mSATA SSD上,但是机子BIOS的Boot选项没有mSATA,只有机械盘,怎么办? 解决 ...

  6. Anaconda下的 Jupyter Notebook 安装 多python环境

    装完 Anaconda 会自带一个pyhon环境   也会自带Jupyter Notebook   可以点击开始中的Jupyter Notebook 打开 浏览器 我这里是 3.x 想要装个2.7 的 ...

  7. windows编程-socket

    server部分 ,Initialize Winsock. ,Create a socket. ,Bind the socket. ,Listen on the socket for a client ...

  8. REVISITING FINE-TUNING FOR FEW-SHOT LEARNING

    https://arxiv.org/pdf/1910.00216.pdf   明天看

  9. dwr超时

    DWR可以指定超时设置: 1.设置局部超时: RemoteBean.remoteMethod(param1, param2, ..., { callback: callbackfun, //回调函数 ...

  10. maven知识结构笔记

    1.什么是maven Maven 翻译为"专家"."内行",是 Apache 下的一个纯 Java 开发的开源项目.基于项目对象模型(缩写:POM)概念,Mav ...