Skip to content

Instantly share code, notes, and snippets.

@sina-programer
Created June 26, 2025 09:53
Show Gist options
  • Save sina-programer/95a07e31e0a80b6191e03f1183e3ddbc to your computer and use it in GitHub Desktop.
Save sina-programer/95a07e31e0a80b6191e03f1183e3ddbc to your computer and use it in GitHub Desktop.
print numbers 1-n in desired number of columns
n = 11
cols = 3
k = 0
while k < n:
k += 1
if k%cols == 0:
print(k)
else:
print(k, end=', ')
print()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment