Functions with Parameters SumAndProduct.py 1 2 SumAndProduct.py - This program computes sums and products. Summary 3 Input: 4 Output: Computed sum and product. Interactive. In this lab, you complete a partially written Python program that includes two functions that require a single parameter. 8 # Write sums () function here. The program continuously prompts the user for an integer until the user enters O. The program 9 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 10 11 # Write products() function here. 12 13 14 numberString = input("Enter a positive integer or 0 to quit: ") 15 number = int(numberString) number. The source code file provided for this lab includes the necessary input statement. Comments are 16 included in the file to help you write the remainder of the program. 17 while number != 0: 18 19 # Call sums () function here. Instructions 20 # Call products() function here. 21 1. Make sure the file SumAndProduct.py is selected and open. numberString = input("Enter a positive integer or 0 to quit: ") number = int(numberString) 22 2. Write the Python statements as indicated by the comments. Remember to output the sum and 23 24 product to the console. 3. Execute the program by clicking the Run button at the bottom of the screen.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
# Functions with Parameters

## Summary

In this lab, you will 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

1. Make sure the file **SumAndProduct.py** is selected and open.
2. Write the Python statements as indicated by the comments. Remember to output the sum and product to the console.
3. Execute the program by clicking the **Run** button at the bottom of the screen.

---

### SumAndProduct.py

```python
"""
SumAndProduct.py - This program computes sums and products.
Input: Interactive.
Output: Computed sum and product.
"""

# Write sums() function here.

# Write products() function here.

numberString = input("Enter a positive integer or 0 to quit: ")
number = int(numberString)

while number != 0:
    # Call sums() function here.

    # Call products() function here.

    numberString = input("Enter a positive integer or 0 to quit: ")
    number = int(numberString)
```
Transcribed Image Text:# Functions with Parameters ## Summary In this lab, you will 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 1. Make sure the file **SumAndProduct.py** is selected and open. 2. Write the Python statements as indicated by the comments. Remember to output the sum and product to the console. 3. Execute the program by clicking the **Run** button at the bottom of the screen. --- ### SumAndProduct.py ```python """ SumAndProduct.py - This program computes sums and products. Input: Interactive. Output: Computed sum and product. """ # Write sums() function here. # Write products() function here. numberString = input("Enter a positive integer or 0 to quit: ") number = int(numberString) while number != 0: # Call sums() function here. # Call products() function here. numberString = input("Enter a positive integer or 0 to quit: ") number = int(numberString) ```
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY