+1 vote
in Python by
Pattern questions. Print the following pattern

1 Answer

0 votes
by
#

# #

# # #

# # # #

# # # # #

Solution –>

def pattern_1(num):

      

    # outer loop handles the number of rows

    # inner loop handles the number of columns

    # n is the number of rows.

    for i in range(0, n):

      # value of j depends on i

        for j in range(0, i+1):

          

            # printing hashes

            print("#",end="")

       

        # ending line after each row

        print("\r")  

num = int(input("Enter the number of rows in pattern: "))

pattern_1(num)

Related questions

0 votes
asked Jan 11, 2021 in Python by SakshiSharma
0 votes
asked Jun 28, 2020 in Python by Robindeniel
...