sh_10_ nested Print Little Star

 

sh_10_ nested Print Little Star

1  # demand 
2  #
 3  # continuous output * Five console, the number of each planet ascending order numbers 
4  # * 
5  # ** 
6  # *** 
7  # **** 
8  # ***** 
9  # development steps 
10  #
 11  # 1> 5 complete line of content simple output 
12  # 2> internal analysis of each line * what should I do? 
13 is  
14 Row. 1 =
 15  
16  the while Row <=. 5 :
 . 17  
18 is      # of each row is to be printed and the stars of the current line number is consistent with 
19      #Adding a small loop, responsible for the current row, each column `` display stars 
20      # 1. Define a variable column counter 
21 is      COL. 1 =
 22 is  
23 is      # 2. Start cycle 
24      "" " 
25      . 1. 1
 26 is      2 2
 27      . 3. 3
 28      . 4. 4
 29      . 5. 5
 30      "" " 
31 is      the while COL <= Row:
 32  
33 is          # Print ("% D "% COL) 
34 is          Print ( " * " , End = " " )
 35  
36          COL + =. 1
 37 [  
38 is      #print ( "% d row" Row%) 
39      # line object code, a line of stars is output after completion, wrap! 
40      Print ( "" )
 41 is  
42 is      Row + =. 1

 

Guess you like

Origin www.cnblogs.com/shaohan/p/11496510.html