Question

Using python, Write a function max3 that takes three numbers as its arguments and returns the...

Using python, Write a function max3 that takes three numbers as its arguments and returns the greatest of these three numbers. Your submitted file for this problem should include (a) function definition, obviously, and (b) the code that calls that function (for this problem you do not have to package that calling code into the main() function although you may if you want to), so that if I run your *.py file it computes and prints something (e.g. few test examples - you can hardcode a few function calls, no need to ask the user to enter the three numbers)

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def max3(a,b,c):           #function definition for max3, it has three arguments a,b & c
    a = max(a,b,c)         #calculate the greater among three and store in a
    return a                #return the graetest number

x =max3(1,15,3)              #call the function by passing three argument and store the result in variable x
print(x)                      #print the result  

y = max3(10,20,30)
print(y)

z = max3(-1,-2,-3)
print(z)

Screenshot:

Add a comment
Know the answer?
Add Answer to:
Using python, Write a function max3 that takes three numbers as its arguments and returns the...
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