+ 2

I want to Print the pattern using dual for loops In python...pattern:5,4,3,2,1\n5,4,3,2\n5,4,3\n5,4\n5

for loop easy pattern

4th Mar 2018, 4:34 AM
Kaival
Kaival - avatar
8 Respostas
+ 9
well , I am not a python boy [not started yet] //I tried making a code ... might taken more lines than req. //hope it helped now ☺ https://code.sololearn.com/csH6h33t52xr/?ref=app
4th Mar 2018, 7:43 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 8
U mean u can do only increment in possible //okh , I have a solution for that also 1) ... same as i mentioned in above comment 2)run a loop from k=1 to k=5-n+1 ... print 5-k+1 for each iteration 3)...same as i mentioned in above comment //good luck ... by making 5-6 different patterns ... u'll be able to do these pattern questions very very easily
4th Mar 2018, 6:10 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 6
1) see that u need 5 rows ... therefore run a loop from n=1 to n=5 2) for each outer loop u need to make a loop from k=5 to k=n 3) just after inner loop ends , puts aprint statement to get to next line // and pattern will be ready ☺👍
4th Mar 2018, 6:01 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 1
i tried Bro all the ways But the thing is In for loop range is not accepting n to 0 and hence output is blank
4th Mar 2018, 6:03 AM
Kaival
Kaival - avatar
+ 1
ok will try btw i m new to python so...
4th Mar 2018, 6:11 AM
Kaival
Kaival - avatar
+ 1
bro its not working can u send me the code ty
4th Mar 2018, 7:20 AM
Kaival
Kaival - avatar
+ 1
thanks Buddy
4th Mar 2018, 7:45 AM
Kaival
Kaival - avatar
0
thanks Jay mathews 👍♥️
4th Mar 2018, 8:11 AM
Kaival
Kaival - avatar