brennerm / PyTricks

Collection of less popular features and tricks for the Python programming language
MIT License
3.07k stars 502 forks source link

patternify #102

Open satyasahoo210 opened 5 years ago

satyasahoo210 commented 5 years ago

traditional way

'''
Printing the pattern
*
**
***
****
'''
for i in range(1,4+1):
    for j in range(i):
       print('*', end='')
    print()

hack

print('\n'.join(['*' * i for i in range(1, 4+1)])