Question: Suppose that the input is 3 4 67 2-1. What is the output of the following code? sum = int(input(Enter sum: )) num =
Suppose that the input is 3 4 67 2-1. What is the output of the following code? sum = int(input("Enter sum: ")) num = sum while num !=-1: num = int(input(Enter num: ")) sum = sum+2*num %3D print(sum) What is the value of sum when the program finishes executing? Suppose that the input is: 38 35 71 14 -1.What is the output of the following code?Assume all variables are properly declared. sum = 0 number = int(input("Enter numbers to sum (enter -1 to quit): ")) %3D while number != -1: sum = sum + number %3D number= int(input('Enter next number: )) print(sum) What is the value of sum?
Step by Step Solution
3.37 Rating (150 Votes )
There are 3 Steps involved in it
1 The value of sum is 39 Explanation The initial value of sum is 3 and num is also 3 In the ... View full answer
Get step-by-step solutions from verified subject matter experts
