How I come out of this logic? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How I come out of this logic?

6. 5. 5. 8 4. 9 3. 10 2. 11 1. 12 How I come out of this logic means if I write 1 ,12 will be printed if I write 2 11 will be printed if I write 3. 10will be printed if I write 4. 9 will be printed and so on like this

30th Jan 2021, 9:53 AM
ankit singh
ankit singh - avatar
3 Answers
+ 1
Ok I think I interpreted it correctly. In python: x = 12-(x-1)%12+(x-1)//12*12 And to test: arr = [(x, 12-(x-1)%12+(x-1)//12*12) for x in range(1,37)] print(arr)
30th Jan 2021, 11:22 AM
Benjamin Jürgens
Benjamin Jürgens - avatar
0
But that not fit on mah logice when I come to the n terms like this 18. 19 17. 20 16. 21 15. 22 14. 23 13. 24 And so on on series like this
30th Jan 2021, 10:05 AM
ankit singh
ankit singh - avatar
0
Then it must be a more complex equation that simplifies to 13-x for 1-12 like Odex 🇮🇹 said. Can you please write all expected values for 1-30 (at least)?
30th Jan 2021, 11:01 AM
Benjamin Jürgens
Benjamin Jürgens - avatar