How to Print the Inverse Rows in Python


Here this example will tell us how to print a positive, inverse # type patterns of the given rows in Python.

Source Code

#! /usr/bin/env python3
# -*- coding: utf-8 -*-

n = int(input("Please input the row number: "))
for i in range (1, n+1):
    print(i * "#")
print("")
for j in range (n, 0, -1):
    print((n - j) * " " + j * "#")

Output:

Please input the row number: 5
#
##
###
####
#####

#####
 ####
  ###
   ##
    #
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
Advertisement