Question

python programming. what is reuse? How is it used in programming? Is reuse a good thing;...

python programming.

what is reuse? How is it used in programming? Is reuse a good thing; please explain.

Homework Answers

Answer #1
what is reuse?
reuse means using the same code multiple times without writing the same code again and again.

How is it used in programming?
reuse is done using methods.
We can define function once and then use it for multiple times.

Is reuse a good thing?
Yes, It gives more readability and most efficient.

Example:
-----------
def divide(a,b):
    if(b==0):
        return None
    else:
        return a/b

def main():
    print(divide(4,3))
    print(divide(4,0))

main()
Know the answer?
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
Similar Questions
What is the purpose of carrying inventory? Is inventory a good thing or a bad thing?
What is the purpose of carrying inventory? Is inventory a good thing or a bad thing?
Define what is meant by reuse and explain the three basic steps involved in software reuse?...
Define what is meant by reuse and explain the three basic steps involved in software reuse? (Abstraction, storage, and recontextualization)
please explain how learning linear programming will be used in a business major in 100-150 words
please explain how learning linear programming will be used in a business major in 100-150 words
* What are antioxidants? Why is that a good thing to advertise in a product? And...
* What are antioxidants? Why is that a good thing to advertise in a product? And why do we need ANTI-oxidants? What is oxidation? * Describe the term “nitrogen-fixing”. Why is nitrogen important for legumes? What is it used for in the plant? * California grows a lot of rice, especially in the areas north of Sacramento. Describe how rice is grown and harvested. * What is biodiesel and why is it “trendy” or popular today? * Pretend you are...
Python Programming Q : Please solve the problem.   ************* my grade ************* ****performance records***** print() 95-100:...
Python Programming Q : Please solve the problem.   ************* my grade ************* ****performance records***** print() 95-100: A+      90- 94: A 95-89: B+ ************** print() Your grade is B+.
Use python programming: Capitalise first letter of each word "hello programmer" becomes Hello Programmer. Explain each...
Use python programming: Capitalise first letter of each word "hello programmer" becomes Hello Programmer. Explain each line of code through comments
what would be a good thing about pH changes along digestive tract
what would be a good thing about pH changes along digestive tract
The last thing we will learn about in python is functions. Functions are a great way...
The last thing we will learn about in python is functions. Functions are a great way to organize your program - we use them to write code that is executed only under certain circumstances - for instance when you're using Amazon, any of the following are likely functions within their program: - Add item to cart, determine arrival date,  create a new address, compute taxes, compute shipping charges, charge credit card Because you can write a task-specific function once, and ensure...
Using the code as an example, explain why Python is a fixed format programming language. Describe...
Using the code as an example, explain why Python is a fixed format programming language. Describe what would be output for each of the print statements in the code listing.- Given the difference in output, explain the different roles of readLine(), readLines(), and read() functions. with open("rainfall.txt","r") as inFile:    aLine = inFile.readLine() with open("rainfall.txt", "r") as inFile:   lineList = inFile.readLines() with open("rainfall.txt", "r") as inFile:   fileString = inFile.read()) print(aLine) print(lineList) print(fileString)
1) How do you choose the frequency reuse factor when designing a cellular system? Explain the...
1) How do you choose the frequency reuse factor when designing a cellular system? Explain the trade-off between system capacity and co-channel interference. 2) What are the functions of base station (BS) and mobile unit respectively during a soft hand-off procedure? 3) What is hand-off and how many different hand-offs are being used for modern wireless communications? 4) How do you reduce co-channel interference and adjacent channel interference? 5) How is cell splitting used to increase cellular system capacity? Explain...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT