Remove items from a list while iterating
Description:
In this question, You need to remove items from a list while iterating but without creating a different copy of a list.
Remove numbers greater than 50
Given:
number_list = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100]
Expected Output: -
[10, 20, 30, 40, 50]
Hint:
delkeywordSolution1:Using while loop
Solution2:Using for loop and range()
need an explanation for this answer? contact us directly to get an explanation for this answer