Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Textbook Question
Chapter 4, Problem 4AW
Write a loop that asks the user to enter a number. The loop should iterate 10 times and keep a running total of the numbers entered.
Expert Solution & Answer
Learn your wayIncludes step-by-step video
schedule03:14
Students have asked these similar questions
Write a loop that asks the user to enter a number. The loop should iterate 10 times and keep a running total of the numbers entered
write a loop that will display numbers in reverse order from 20 to 0
Write a loop that calculates the total of the following series of numbers:
1/30+2/29+3/28+.....30/1
Chapter 4 Solutions
Starting Out with Python (4th Edition)
Ch. 4.1 - What is a repetition structure?Ch. 4.1 - What is a condition-controlled loop?Ch. 4.1 - What is a count-controlled loop?Ch. 4.2 - What is a loop iteration?Ch. 4.2 - Does the while loop test its condition before or...Ch. 4.2 - How many times will 'Hello world' be printed in...Ch. 4.2 - What is an infinite loop?Ch. 4.3 - Rewrite the following code so it calls the range...Ch. 4.3 - What will the following code display? For number...Ch. 4.3 - What will the following code display? for number...
Ch. 4.3 - What will the following code display? for number...Ch. 4.3 - What will the following code display? for number...Ch. 4.4 - Prob. 13CPCh. 4.4 - Should an accumulator be initialized to any...Ch. 4.4 - What will the following code display? total - 0...Ch. 4.4 - What will the following code display? number 1 =...Ch. 4.4 - Rewrite the following statements using augmented...Ch. 4.5 - Prob. 18CPCh. 4.5 - Why should you take care to choose a distinctive...Ch. 4.6 - What does the phrase garbage in, garbage out mean?Ch. 4.6 - Give a general description of the input validation...Ch. 4.6 - Describe the steps that are generally taken when...Ch. 4.6 - Prob. 23CPCh. 4.6 - If the input that is read by the priming read is...Ch. 4 - A_________-controlled loop uses a true/false...Ch. 4 - A _____-controlled loop repeats a specific number...Ch. 4 - Each repetition of a loop is known as a(n) a cycle...Ch. 4 - The while loop is a _______ type of loop. a....Ch. 4 - A(n) ______ loop has no way of ending and repeats...Ch. 4 - The -= operator is an example of a(n) _________...Ch. 4 - Prob. 7MCCh. 4 - A(n) ____________ is a special value that signals...Ch. 4 - Prob. 9MCCh. 4 - The integrity of a programs output is only as good...Ch. 4 - The input operation that appears just before a...Ch. 4 - Validation loops are also known as _________. a....Ch. 4 - A condition-controlled loop always repeats a...Ch. 4 - The while loop is a pretest loop.Ch. 4 - The following statement subtracts 1 from x: x = x ...Ch. 4 - It is not necessary to initialize accumulator...Ch. 4 - In a nested loop, the inner loop goes through all...Ch. 4 - To calculate the total number of iterations of a...Ch. 4 - The process of input validation works as follows:...Ch. 4 - What is a condition-controlled loop?Ch. 4 - What is a count-controlled loop?Ch. 4 - What is an infinite loop? Write the code for an...Ch. 4 - Why is it critical that accumulator variables are...Ch. 4 - What is the advantage of using a sentinel?Ch. 4 - Prob. 6SACh. 4 - What does the phrase garbage in, garbage out mean?Ch. 4 - Give a general description of the input validation...Ch. 4 - Write a while loop that lets the user enter a...Ch. 4 - Write a while loop that asks the user to enter two...Ch. 4 - Write a for loop that displays the following set...Ch. 4 - Write a loop that asks the user to enter a number....Ch. 4 - Write a loop that calculates the total of the...Ch. 4 - Rewrite the following statements using augmented...Ch. 4 - Write a set of nested loops that display 10 rows...Ch. 4 - Write code that prompts the user to enter a...Ch. 4 - Write code that prompts the user to enter a number...Ch. 4 - Bug Collector The Bug Collector Problem A bug...Ch. 4 - Calories Burned Running on a particular treadmill...Ch. 4 - Budget Analysis Write a program that asks the user...Ch. 4 - Distance Traveled The distance a vehicle travels...Ch. 4 - Average Rainfall Write a program that uses nested...Ch. 4 - Celsius to Fahrenheit Table Write a program that...Ch. 4 - Pennies for Pay Write a program that calculates...Ch. 4 - Sum of Numbers Write a program with a loop that...Ch. 4 - Ocean Levels Assuming the ocean's level is...Ch. 4 - Tuition Increase At one college, the tuition for a...Ch. 4 - Weight Loss If a moderately active person cuts...Ch. 4 - Calculating the Factorial of a Number In...Ch. 4 - Population Write a program that predicts the...Ch. 4 - Prob. 14PECh. 4 - Prob. 15PECh. 4 - Turtle Graphics: Repeating Squares In this...Ch. 4 - Turtle Graphics: Star Pattern Use a loop with the...Ch. 4 - Turtle Graphics: Hypnotic Pattern Use a loop with...Ch. 4 - Turtle Graphics: STOP Sign In this chapter, you...
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Write a program that reads records of type Pet from a file created by the program described in the previous pro...
Java: An Introduction to Problem Solving and Programming (8th Edition)
Define a class called List that can hold a list of values of type double. Model your class definition after the...
Problem Solving with C++ (9th Edition)
Extreme programming expresses user requirements as stories, with each story written on a card. Discuss the adva...
Software Engineering (10th Edition)
(Invoice Class) Create a class called Invoice that a hardware store might use to represent an invoice for an it...
Java How To Program (Early Objects)
A criticism of the break statement and the continue statement is that each is unstructured. Actually, break sta...
C How to Program (8th Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- Write a loop that asks the user “Do you want to repeat the program or quit? (R/Q)”. The loop should repeat until the user has entered an R or Q (either uppercase or lowercase).arrow_forwardWhat is the number of times the following loop is executed? for an in the range(100,10,-10): a = 100,10,-10 create a printoutarrow_forwardwrite a loop that calculates the (float) sum of the following series of numbers: 50 + 51 + … + 5000. The numbers should not be pre-calculated, rather the loop should cause the increment/decrement.arrow_forward
- This is a continuation from the previous question. Pervious question answer is float hours = sc.nextFloat(); use this for this question Now that the hours have been entered, write a loop that will run as long as the user enters bad hours data (0 or negative hours). If the user entered bad hours data, it asks them again with the message Not a valid amount of hours. Enter the hours again:arrow_forwardHow many time will the loop run? int count = 14; while( count <= 51 ) { count++; }arrow_forwardWhat will be the value of x after the following code is executed? int x = 10, y = 20; while (y < 100) { x = x + y; } A) 90 B) 110 C) 210 D) This is an infinite loop.arrow_forward
- What is the output for the following loop? int number; bool done; number = 2; done = FALSE; while (!done) { number = number * 2; if (number > 12) done = TRUE; cout << number << endl; }arrow_forwardIf you need to write a do-while loop that will ask the user to enter a number between 2 and 5 inclusive, and will keep asking until the user enters a correct number, what is the loop condition? a.(2<=num<=5) b.(2<5<number) c.(2 <= number && number <= 5) d. 2 < number || number > 5)arrow_forwardAllow the user to input any number. Loop exits when the number inputted is zero.arrow_forward
- Write a loop that will print the numbers from 0 to 1000 in steps of 50. When the number is 800 or higher, it should break out of the loop. (Use Java)arrow_forwardDesign a loop that asks the user for a positive integer value and use a loop toget the sum of all odd integers from 1 up to the number entered. For example, if theuser enters 50, the loop will find the sum of 1, 3, 5, 7, ... 49. (Writing pseudocode)arrow_forwardwrite a loop that will sum the odd integers from 3 to 17 and print that sumarrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Microsoft Visual C#Computer ScienceISBN:9781337102100Author:Joyce, Farrell.Publisher:Cengage Learning,
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Control Structures - while loop - do-while loop - for loop - Goto - break - continue statements; Author: EzEd Channel;https://www.youtube.com/watch?v=21l11_9Osd0;License: Standard YouTube License, CC-BY