(Nov-17-2023, 01:20 PM)deferender Wrote: Now im fine.
doing this.
def find_average(num_a: int, num_b: int) -> float: average = (num_a + num_b) // 2 return average print(find_average(18, 8))Thank you all!
That's fine, but it's not at all flexible. What if you have more than two numbers? The main points about coding a function, is that said function should do as its name suggest and be useful for more than one particular circumstance.
In fact, what you have there does not even work correctly.
Sig:
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein
>>> import this
The UNIX philosophy: "Do one thing, and do it well."
"The danger of computers becoming like humans is not as great as the danger of humans becoming like computers." :~ Konrad Zuse
"Everything should be made as simple as possible, but not simpler." :~ Albert Einstein