80.0k views
19 votes
7.3 Code Practice edhesive

Write a function named print_sum that accepts three numbers as parameters and prints the sum. First, write the print_sum function. Then, prompt the user for three inputs, and call your print_sum function on those inputs.

Sample Run:
Enter the 1st number: 11
Enter the 2nd number: 9
Enter the 3rd number: 8
The sum: 28

User Almett
by
4.8k points

1 Answer

4 votes

def print_sum(a,b,c):

print(a+b+c)

one = int(input("Enter the 1st number: "))

two = int(input("Enter the 2nd number: "))

three = int(input("Enter the 3rd number: "))

print_sum(one,two,three)

I wrote my code in python 3.8. I hope this helps.

User Jonnnnnnnnnie
by
5.4k points