Based on a 12 "notebook, it's usually up to 25 lines including comments.
When a for statement or an if statement occurs, think about it once again.
The block could be separated by semantics. Try to summarize the comments as a function name.
A program is basically a combination of data and algorithms process the data.
Recommended linting and formatting tools contain most of the best practices.
It is also good to warm up brain
Even if it's not available now, it makes easy to add tests next time when adding, modifying, or refactoring your functions.