SHARE
TWEET

Untitled

a guest Oct 14th, 2019 143 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #        1
  2. #      1 2 1
  3. #    1 2 3 2 1
  4. #  1 2 3 4 3 2 1
  5. #1 2 3 4 5 4 3 2 1
  6.  
  7. user_rows = int( input() )
  8.  
  9. for row in range(1, user_rows + 1):
  10.     #Front side space
  11.     print( " " * (2 * (user_rows - row)), end = '' )
  12.     #Ascending order Pattern
  13.     print( " ".join( str(icounter) for icounter in range(1, row + 1)), end = '' )
  14.     #Middle space between both ascending and descending pattern
  15.     if not row == 1:
  16.         print(" ", end = '')
  17.     #Descending order Pattern
  18.     print( " ".join( str(icounter) for icounter in range(row-1, 0, -1)), end = '' )
  19.     #Next line at all lines except last one
  20.     if not row == user_rows:
  21.         print("")
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top