October 31, 2022 |2.0K Views

    Python program to print the pattern ‘G’

      Share  3 Likes
    Description
    Discussion

    Python program to print 'G' Pattern

    In this video, we will write a Python program to print the pattern ‘G’. To print the character, we have have to take an input that will denote the numbers the lines or size the pattern needs to be. We have to write conditions for each of the lines that make up the pattern ‘G’.

    We have used the simple logic of iteration over lines to create the pattern G. Column-wise procedures are being carried out in this case. Therefore, for the first line of stars, we set the first if the condition so that all rows from 1 to (n-1) will receive stars while rows 0 and (n-1) will not. 

    Analyzing the complexity of program
    Space Complexity: O(1)
    Time Complexity: O(n^2)