+ 3

Pls help me to print the following code in Python

1 2 6 3 7 10 4 8 11 13 5 9 12 14 15

28th Aug 2019, 5:47 PM
♡ holographic _heart ♡
♡ holographic _heart ♡ - avatar
8 Réponses
+ 6
Well this is really not as easy as it first seemed, but in the end I was able to crack a formula: https://code.sololearn.com/cyd47tW9jB6T/?ref=app
29th Aug 2019, 6:33 AM
Tibor Santa
Tibor Santa - avatar
+ 5
Thank you very much Tibor Santa
29th Aug 2019, 9:39 AM
♡ holographic _heart ♡
♡ holographic _heart ♡ - avatar
+ 3
Let me also try, although my way is not as elegant as Tibor's. :) n=5 for i in range(1, n+1): l = list(range(1, n))[n-i:] print(i, end=' ') while l: i += l.pop() print(i, end = ' ') print()
29th Aug 2019, 10:07 AM
HonFu
HonFu - avatar
+ 1
Yeah here I'm giving the way I tried but failed: K=1 for i in range (1,6): for j in range (i,0,-1): print(k,end="") K=k+1 print () Can you just say me where I've made the mistake?
28th Aug 2019, 5:57 PM
♡ holographic _heart ♡
♡ holographic _heart ♡ - avatar
0
The point of these riddles is that you solve them yourself, for training. So your teacher would be very unhappy if we just gave you the solution. Wanna share an attempt of your own?
28th Aug 2019, 5:53 PM
HonFu
HonFu - avatar
0
Please can you help me ???🥺
28th Aug 2019, 6:04 PM
♡ holographic _heart ♡
♡ holographic _heart ♡ - avatar
0
Remind that you defined K as capital letter.
29th Aug 2019, 5:41 AM
MNM
0
MNM I don't think so I think he wrote the code himself here and didn't copy this from the code playground so the keyboard made his first letter capitalize.
29th Aug 2019, 6:16 AM
Eliya Ben Baruch
Eliya Ben Baruch - avatar