Question

Explain What is sentinel in python. Calculating a Running Total

Explain

What is sentinel in python.

Calculating a Running Total

Homework Answers

Answer #1

What is sentinel in python.

sentinel is value which we use to stop the loop
like reading numbers from the user untill he enteres -1
so here -1 is sentinel

Running total is reading values from user and adding to sum

Exampl:

n=int(input("Enter number (-1 to exit): "))
total = n
print("Total: ",total)
while(n!=-1):
        n=int(input("Enter number (-1 to exit): "))
        total+=n
        print("Total: ",total)
        

NOTE : PLEASE COMMENT BELOW IF YOU HAVE CONCERNS.

I AM HERE TO HELP YOUIF YOU LIKE MY ANSWER PLEASE RATE AND HELP ME IT IS VERY IMP FOR ME

Know the answer?
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for?
Ask your own homework help question
Similar Questions
explain what a Sentinel control value is. What control structure uses it? In what context do...
explain what a Sentinel control value is. What control structure uses it? In what context do you think Sentinel Control value is commonly use?
What is a Sentinel event? Why are they important?
What is a Sentinel event? Why are they important?
Python Programming questions, Multiple Choice Questions: 5) MCQ What function call will generate a random number...
Python Programming questions, Multiple Choice Questions: 5) MCQ What function call will generate a random number in the range of 1 through 6 using the random module? a. random.randnum(1, 6) b. random.randint(range(1-6)) c. random.randint(1, 6) d. random.random(1, 6) 6) MCQ In a conditional iteration loop, such as a while loop, what is a sentinel value? a. A sentinel value is a user-provided input value that proceeds to the next loop. b. A sentinel value is a user-provided input value that...
What are doctors looking for when they perform a sentinel node biopsy?
What are doctors looking for when they perform a sentinel node biopsy?
About python: Explain what is Polymorphism and provide a code snippet
About python: Explain what is Polymorphism and provide a code snippet
PYTHON Write a python function that will return the total length of line that passes through...
PYTHON Write a python function that will return the total length of line that passes through any number of provided points ( (x,y) ). The points should be passed as individual tuples or lists. The function should also have a parameter (True or False) to indicate whether the line should start from the origin, and that parameter should default to False. If True, the returned value should include the distance from the origin to the first point, otherwise start adding...
"Python strings are immutable" Explain in details what is that mean. Provide examples of strings in...
"Python strings are immutable" Explain in details what is that mean. Provide examples of strings in Python and how it can be used
Python Indicate whether each statement will evaluate to True or False after running these initializations: a...
Python Indicate whether each statement will evaluate to True or False after running these initializations: a = False x = 0 x == 0 and a x == 0 or a x == 0 and not a x == 0 or not a x != 0 and a x != 0 or a x != 0 and not a x != 0 or not a
What are some examples of sentinel events? Describe the impact of poor quality care on the...
What are some examples of sentinel events? Describe the impact of poor quality care on the individual, family, community, and the United States. Create a core value statement.
What are some examples of sentinel events? Describe the impact of poor quality care on the...
What are some examples of sentinel events? Describe the impact of poor quality care on the individual, family, community, and the United States. Create a core value statement
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT