Answer to Question #345575 in Python for D.K

Question #345575

Write the function sum() with four parameters the calculates the arguments provided and returns their sum

Parameters four variables of type float

Returns the sum of type float

Use the default argument 4 to declare the last two parameter of the function sum() test the function sum() by calling it by three possible methods use random integers as arguments


1
Expert's answer
2022-05-27T09:39:18-0400
def sum(a1, a2, a3 = 4, a4 = 4):
    return a1+a2+a3+a4
print(sum(1.5, 2, 3.5))
print(sum(7, 0.2))
print(sum(1.5, 2, 3.5 , 6.8))

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS