Question: Question 1 2 ( 1 point ) Suppose you want to use a string sentinel value of Q to quite a loop instead
Question point
Suppose you want to use a string sentinel value of Q to quite a loop instead of a number. What needs to change in the following code snippet for this to work?
total
count
userInput float inputEnter a value or Q to quit:
while userInput Q :
total total userInput
count count
userInput float inputEnter a value or Q to quit:
Nothing. The code works correctly
Q should be in single qtotes, Q
count should be updated outside the loop
The conversion of userInput to a floatingpoint value should be done inside the while loop after reading in a value.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
