OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

How to iterate through a python list to get each additional list element? [closed]

  • Thread starter Thread starter Charles Jr
  • Start date Start date
C

Charles Jr

Guest
I have a python list that I need to iterate through to get the additional consecutive element.

data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]

I need to turn this into a string that reads like...

data_string = "1, 3, 6, 10"

I'm new to python and having trouble. Any ideas?
<p>I have a python list that I need to iterate through to get the additional consecutive element.</p>
<p><code>data = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13]</code></p>
<p>I need to turn this into a string that reads like...</p>
<p><code>data_string = "1, 3, 6, 10"</code></p>
<p>I'm new to python and having trouble. Any ideas?</p>
 
Top