Created
June 26, 2025 09:53
-
-
Save sina-programer/95a07e31e0a80b6191e03f1183e3ddbc to your computer and use it in GitHub Desktop.
print numbers 1-n in desired number of columns
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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