+ 1
can someone kindly correct me if i am wrong about this quote "As the program contains multiple lines of code, you should create it as a separate file and run it." does that mean that if my code gets bigger it is advisable to create less line of codes but many files?
4 ответов
+ 3
You are absolutely right! It's a good practice to limit the size of a source file. If your source file is too big, it will be difficult to understand and you should segment it more. But I think the most important is to have short function (when I started learning programming, it was told not to exceed one screen page for a function, in order to be understood without scrolling). Of course, if you have to many functions in a file you may segment it in different files.
OOP will help you to do this because you can make class and group coherent function.
+ 2
I guess it all comes down to coding style and preference if you prefer larger files or calling multiple files...
but to answer your question on the text above; it just means that you will get better results from calling the python script from the interpreter rather than just using the online console to test your code.
+ 1
thanks pal
0
you're welcome !