1 1 2 1 2 3 1 2 3 4 | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

1 1 2 1 2 3 1 2 3 4

how to write this with python

20th Oct 2016, 6:03 AM
Anju kv
Anju kv - avatar
1 Answer
+ 1
n=4 w=2*n+1 for i in range(1,n+1): x=list(map(str,list(range(1,i+1)))) print(" ".join(x).center(w)) change the value of n to change output code is in python 3
20th Oct 2016, 8:08 AM
Sunera
Sunera - avatar