[Python] [24] [demo experimental practice examples] [print pattern]

Original title:

Print out the following pattern (diamond):

   *
  ***
 ***** ******* ***** *** *

 

My source:

# ! / Usr / bin / Python 
# encoding = UTF-8 
# - * - Coding: UTF-8 - * - 

#   print the following pattern: 
#    * 
#   * * * 
# ***** 
# ****** * 
# ***** 
#   *** 
#    * 

X = int (INPUT ( " Please the INPUT number: \ n- " ))     # * * most row number 

for I in Range (. 1,. 1 + X ) :
     Print ((X +. 1-I) * "  " , End = "" )
     Print ((2 * I -. 1) * " *")
for i in range(x-1,0,-1):
    print((x+1-i)*" ",end="")
    print((2*i - 1)*"*")

 

 

 

Output:

 

 

 

The procedure given in the original title:

 

 

 

 

 

 


-------- (I am dividing line) --------

reference:

1. RUNOOB.COM:https://www.runoob.com/python/python-exercise-example23.html

 

 

Remarks:

Initial modified: October 3, 2019 15:38:37

Environment: Windows 7 / Python 3.7.2

Guess you like

Origin www.cnblogs.com/kaixin2018/p/11619873.html