Computers and Technology

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 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 code" button at the bottom of the screen.

"""
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)

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 14:50, williamsgregg5214
Drag each label to the correct location on the image list the do’s and don’ts of safeguarding your password. a. keep yourself logged in when you leave your computer. b. don’t write your password down and leave it where others can find it. c. share your password with your friends. d.each time you visit a website, retain the cookies on your computer. e. use a long password with mixed characters.1. do's 2. don'ts
Answers: 2
image
Computers and Technology, 23.06.2019 07:30, devnnn44
What is the original authority for copyright laws
Answers: 1
image
Computers and Technology, 23.06.2019 16:30, rileysndr1782
Monica and her team have implemented is successfully in an organization. what factor leads to successful is implementation? good between different departments in an organization leads to successful is implementation.
Answers: 1
image
Computers and Technology, 24.06.2019 09:10, daedae11142
  to change the number of rows and columns displayed by the excel object a. select the object and drag a size handle on the active object. b. deselect the object and drag a size handle of the object. c. deselect the object and drag a row or column divider of the object. d. select the object and drag a row or column divider on the active object.
Answers: 2
Do you know the correct answer?
The program continuously prompts the user for an integer until the user enters 0. the program then p...

Questions in other subjects:

Konu
Social Studies, 04.08.2019 20:00
Konu
English, 04.08.2019 20:00