6 AnswersNew Answer
Ah, I think now I have some more clue, on what is the problem. But to be honest, I didnt really understand your code... But maybe this code bit helps a little on the Overall issue: https://code.sololearn.com/cqdFxQ8f15MO/?ref=app
MsM!67 You missed ) after list Also you cannot iterate list like that.
Thanks for pointing that missed bracket but I had posted the question because of typeerror which is raised due to this for statement Hoping to get the answer soon
As 🅰🅹 (Challenge Accepted) mentioned, it is not allowed to iterate on a list like this. If you want to print the first 4 members of the list, try this: rnglst=list(range(1,101)) for num in rnglst[:4]: print(num) In this for loop you go through every Element of the list. On each Iteration, the current Element is represents as num, in this example. [:4] defines the "Limits" for the Iteration. It is similar to [0:4], while 0 Can be omitted. It means, to use a slice of the list from Element 0 to Element 3, in other words -> [startIndex : endIndex], while endIndex is exclusive, so the last Element is endIndex - 1.
Thanks but might I am not able to explain the problem so would you please check out my code and then please suggest some nonintutive /intuitive or a correct way to iterate through that list. Please suggest me a way to do that using a for loop if possible.
Thanks That was great!