Challenge: Create a Sum Function
Swipe to start coding
Implement a function sum that takes three arguments (a, b, and c) and returns their sum.
Next, call this function twice, using the following sets of arguments:
- Use
24,12, and32for the first function call and store the result in the variablesum1. - Use
12,42, and5for the second function call and store the result in the variablesum2.
Finally, print the results of both function calls.
The output should be:
sum1 = 68
sum2 = 59
Solution
Thanks for your feedback!
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat
Can you explain this in simpler terms?
What are the main points I should remember?
Can you give me an example?
Awesome!
Completion rate improved to 2.5
Challenge: Create a Sum Function
Swipe to show menu
Swipe to start coding
Implement a function sum that takes three arguments (a, b, and c) and returns their sum.
Next, call this function twice, using the following sets of arguments:
- Use
24,12, and32for the first function call and store the result in the variablesum1. - Use
12,42, and5for the second function call and store the result in the variablesum2.
Finally, print the results of both function calls.
The output should be:
sum1 = 68
sum2 = 59
Solution
Thanks for your feedback!
single