DEV Community

Discussion on: Daily Challenge #201 - Complete the Pattern

Collapse
 
maskedman99 profile image
Rohit Prasad

Python

var = float(input("Enter the number: "))

def pattern(var):
        if var < 1:
                print("")
        else:
                var = int(var)
                for i in range(var+1):
                        for j in range(i):
                                print(i,end = '')
                        print('\n',end='')

pattern(var)