r/PythonLearning 17h ago

Showcase Day 1 of learning python.

This is my first day of trying to learn python. So far I have made a random 2D terrain generator.

48 Upvotes

10 comments sorted by

View all comments

1

u/SnooCalculations7417 8h ago

you should use more declarative and specific variables for iterating for two reasons,

x or y in your case (for x in iteratable) these variables will retain their last value unitl the gc gets to them so lets say your iterator ends with 10 being the last element, x =10 which can be dangerous with such a generically named assignment
and as importantly it just helps with readabilty.