Patterns in python in reversed order | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 28

Patterns in python in reversed order

I believe sololearn is a community which also give assisstance. Im stucked here and needs help Im Trying to print this number pattern in this way 5, 545, 54345, 5432345, 543212345 Theres my code and thats howfar i could go now im stucked. https://code.sololearn.com/c0LSujY0t9Xi/?ref=app

21st Sep 2019, 10:11 PM
BlackRose Mike
BlackRose Mike - avatar
7 Answers
+ 11
It's bad practice to print inside a function, and not return any value, here is how I did it: def pattern(n): l = [[n]] for i in range(n-1, 0, -1): l.append(l[-1]+[i]) for i in range(1, len(l)): l[i]+=l[i][::-1][1:] return l print(pattern(5))
21st Sep 2019, 10:46 PM
Aymane Boukrouh
Aymane Boukrouh - avatar
+ 20
Aymane Boukrouh thankx that will be of much help. Fixing it together
22nd Sep 2019, 9:34 AM
BlackRose Mike
BlackRose Mike - avatar
+ 19
David Ashton I finally completed, thankx alot for taking out the time to answer https://code.sololearn.com/cJdB2CPMLT44/?ref=app
23rd Sep 2019, 3:42 AM
BlackRose Mike
BlackRose Mike - avatar
+ 18
Bill i solved it half way not fully. Thats why i post it coz i need help with it
22nd Sep 2019, 1:11 AM
BlackRose Mike
BlackRose Mike - avatar
23rd Sep 2019, 3:34 AM
David Ashton
David Ashton - avatar
+ 3
looks like you solved it, kinda cool
21st Sep 2019, 10:47 PM
Bill
Bill - avatar
+ 2
Of course, you can dm me if you need more help
22nd Sep 2019, 10:01 AM
Aymane Boukrouh
Aymane Boukrouh - avatar