0

I have a list named "ul_children", I need to use a for loop to print every other item in that list starting with the second item or the index[1]. I am new to for loops in python and I am struggling with this.

I have tried a few different things I thought would work, but I have been unsuccessful so far. Any help would be appreciated.

The closest I have gotten so far is by using:

i = 1
for li in ul_children: 
   print(ul_children[i])

but I don't know how to get 'i' to increase each time the loop is performed.

Hayden
  • 3
  • 3

1 Answers1

1

You can do it like this:

ul_children = ["r","a","t","o","n"]

for i in ul_children[1:]:

    print(i)