What does it mean for code to be reusable and what good is that?


#1

Question

What does it mean for code to be reusable and what good is that?

Answer

You may hear people mention DRY programming, which stands for Don’t Repeat Yourself. Simple enough, but you’d be surprised how much time and effort you’ll save by following through with it!
Often at times we’ll write code that needs some functionality repeated several times, perhaps even with different values each time. For example, if we tried to calculate the cost of a bill and tip for every meal, we’d have to write out the entire calculation each time for every different meal!
Wouldn’t it be better if we could give the cost of the meal to a function and have it handled the same way regardless of what the meal is or how much it cost?
That’s what we’ll be looking into for the next little while! Making functions that are able to do some action given some input and produce some output, all in the name of saving time and energy!


FAQ: Learn Python - What Good are Functions?
#2

What is the meaning of the *= symbol in code??


#3

if i search: python *=, the first search result:

https://stackoverflow.com/questions/20622890/python-what-does-mean/20622898

google is your friend while programming.