diff options
-rw-r--r-- | doc/data/messages/c/consider-using-enumerate/bad.py | 4 | ||||
-rw-r--r-- | doc/data/messages/c/consider-using-enumerate/good.py | 4 |
2 files changed, 8 insertions, 0 deletions
diff --git a/doc/data/messages/c/consider-using-enumerate/bad.py b/doc/data/messages/c/consider-using-enumerate/bad.py new file mode 100644 index 000000000..25d7cbf6b --- /dev/null +++ b/doc/data/messages/c/consider-using-enumerate/bad.py @@ -0,0 +1,4 @@ +seasons = ['Spring', 'Summer', 'Fall', 'Winter'] + +for i in range(len(seasons)): # [consider-using-enumerate] + print(i, seasons[i]) diff --git a/doc/data/messages/c/consider-using-enumerate/good.py b/doc/data/messages/c/consider-using-enumerate/good.py new file mode 100644 index 000000000..c52c27066 --- /dev/null +++ b/doc/data/messages/c/consider-using-enumerate/good.py @@ -0,0 +1,4 @@ +seasons = ['Spring', 'Summer', 'Fall', 'Winter'] + +for i, season in enumerate(seasons): + print(i, season) |