DiYane

Number Pyramid

Jun 6th, 2023
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.23 KB | None | 0 0
  1. num = int(input())
  2. cnt = 1
  3.  
  4. for row in range (1, num + 1):
  5.     for column in range(1, row + 1):
  6.         print(cnt, end=' ')
  7.         cnt += 1
  8.         if cnt > num:
  9.             break
  10.     if cnt > num:
  11.         break
  12.     print()
Add Comment
Please, Sign In to add comment