I’ve got no idea why this happens, how should my For Loop look if i wanted it to result in “[0, 1, 2, 3, 4]”? Sorry for a silly question and thank you for help.
(i) and [i] are different things, meaning in one of the examples, you’re working with the index of the element in the loop, and in the other you’re working with the actual element.
The algorithm one. I know how to solve it, but i cannot transfer my logic into code because I don’t know how should my For Loop look like if i wanted to get output [0, 1, 2, 3, 4] for example. I do it the way i learned in earlier challenges but as you said “(i) and [i] are different things” - I don’t really comprehend how to refer to the correct element.Pic rel:
I don’t understand why you want the answer from ‘Iterate Odd Numbers With a For Loop’ to be the answer for ‘Find the Longest Words in a String’ because they aren’t the same answers.