Question

While using python programming. If the program is broken into smaller modules where does execution begin?Can...

While using python programming. If the program is broken into smaller modules where does execution begin?Can you Please explain?

I think it is not a good idea to write a large program with only one function because creating a large program can have benefits on using modular programming than less code. Modular programming is the process of subdividing a computer program into separate sub-programs. A module is a separate software component. It can often be used in a variety of applications and functions with other components of the system. Similar functions are grouped in the same unit of programming code and separate functions are developed as separate units of code so that the code can be reused by other applications. Modular programming enables multiple programmers to divide up the work and debug pieces of the program independently. Modules in modular programming enforce logical boundaries between components and improve maintainability. They are incorporated through interfaces. They are designed in such a way as to minimize dependencies between different modules. In the end, I still agree that it is not a good idea to use a large program with one function.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Answer:

Regarding execution in single module:

Every line is executed from the line number 1 of the file. But if def of function comes or class definition comes, then it does not execute that, these functions will executed only when it will be called. All the blocks/lines will be executed unless it some function or class.

Example:

#file name is doSum.py

import sys #line will be executed

import os #line will be executed

print sys.argv[0]   #line will be executed

def sum(a,b): #line will not be executed

return a+b #line will not be executed

print sys.argv[0] #line will be executed

sum(5,6) #now above sum function will be executed

Regarding execution in inter module:

Every line will be executed without function and class definitions like above explained. And also the code in block

< if __name__ == "__main__": > will only be executed if this module is being executed directly not by imported from some other module.

Thumbs up please if answer helps.

Add a comment
Know the answer?
Add Answer to:
While using python programming. If the program is broken into smaller modules where does execution begin?Can...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT