In this lab, you complete a partially written Python program that includes two functions that require a single parameter. The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a function (sums) that computes the sum of all the whole numbers from 1 up to and including the entered number. Next, the program passes the value to another function (products) that computes the product of all the whole numbers up to and including the entered number. The source code file provided for this lab includes the necessary input statement. Comments are included in the file to help you write the remainder of the program. Instructions Make sure the file SumAndProduct.py is selected and open. Write the Python statements as indicated by the comments. Remember to output the sum and product to the console. Execute the program by clicking the Run button at the bottom of the screen.
In this lab, you complete a partially written Python
The program continuously prompts the user for an integer until the user enters 0. The program then passes the value to a function (sums) that computes the sum of all the whole numbers from 1 up to and including the entered number. Next, the program passes the value to another function (products) that computes the product of all the whole numbers up to and including the entered number.
The source code file provided for this lab includes the necessary input statement. Comments are included in the file to help you write the remainder of the program.
Instructions
- Make sure the file SumAndProduct.py is selected and open.
- Write the Python statements as indicated by the comments. Remember to output the sum and product to the console.
- Execute the program by clicking the Run button at the bottom of the screen.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 2 images