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
What is a Sentinel event? Why are they important?
What is a Sentinel event? Why are they important?
About python: Explain what is Polymorphism and provide a code snippet
About python: Explain what is Polymorphism and provide a code snippet
What are doctors looking for when they perform a sentinel node biopsy?
What are doctors looking for when they perform a sentinel node biopsy?
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
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.
Write about strings and input in python. Explain with 2 examples.
Write about strings and input in python. Explain with 2 examples.
1. What are some examples of sentinel events? 2. Describe the impact of poor quality care...
1. What are some examples of sentinel events? 2. Describe the impact of poor quality care on the individual, family, community, and the United States. 3. Create a core value statement.
What is the motivation for calculating consumer surplus, producer surplus, and total surplus? Assume the equilibrium...
What is the motivation for calculating consumer surplus, producer surplus, and total surplus? Assume the equilibrium quantity in a competitive market is 16 and the equilibrium price is 8. Also assume the highest willingness to pay is 14 and the lowest cost is 3. Calculate the consumer surplus, producer surplus, and total surplus for this market.
Hi, could you explain me what we do with salvage value when it comes to calculating...
Hi, could you explain me what we do with salvage value when it comes to calculating cash flows from assets