How to display this output in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How to display this output in python?

It should be made using for loop Output : 1 21 321 4321 54321 1 12 123 1234 12345

11th Sep 2019, 2:24 PM
harsh
harsh - avatar
2 Answers
0
public class Program { public static void main(String[] args) { String k="4321"; for(int i=0;i<k.length();i++){ for(int j=0;j<i+1;j++){ System.out.print(k.charAt(j)); } System.out.println(" "); } } }
11th Sep 2019, 2:32 PM
KfirWe
KfirWe - avatar
0
How could you print 54321 with loop?
11th Sep 2019, 3:32 PM
Seb TheS
Seb TheS - avatar