consider-using-enumerate / C0200#
Consider using enumerate instead of iterating with range and len
Emitted when code that iterates with range and len is encountered. Such code can be simplified by using the enumerate builtin.
seasons = ["Spring", "Summer", "Fall", "Winter"] for i in range(len(seasons)): # [consider-using-enumerate] print(i, seasons[i])
seasons = ["Spring", "Summer", "Fall", "Winter"] for i, season in enumerate(seasons): print(i, season)
Created by the refactoring checker.