001、生成
nN
nnNN
nnnNNN
....
a、
[root@pc1 test1]# ls test.py [root@pc1 test1]# cat test.py ## 测试程序 #!/usr/bin/env python3 # -*- coding: utf-8 -*- for i in range(1,11): for j in range(1,i): print("n", end = "") for k in range(1,i): print("N", end = "") print("") [root@pc1 test1]# python3 test.py ## 执行程序 nN nnNN nnnNNN nnnnNNNN nnnnnNNNNN nnnnnnNNNNNN nnnnnnnNNNNNNN nnnnnnnnNNNNNNNN nnnnnnnnnNNNNNNNNN
b、
[root@pc1 test1]# ls test.py [root@pc1 test1]# cat test.py ### 程序 #!/usr/bin/env python3 # -*- coding:utf-8 -*- for i in range(1,10): k = 1 while k <= i: print("n", end = "") k += 1 k= 1 while k <=i: print("N", end = "") k += 1 print("") [root@pc1 test1]# python3 test.py ## 运行程序 nN nnNN nnnNNN nnnnNNNN nnnnnNNNNN nnnnnnNNNNNN nnnnnnnNNNNNNN nnnnnnnnNNNNNNNN nnnnnnnnnNNNNNNNNN
002、
标签:test1,01,pc1,python,py,range,test,root,生信 From: https://www.cnblogs.com/liujiaxin2018/p/17736473.html