Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Question
For this question you must design and implement a precondition loop in Python that will display the following numbers (one on each line) to the terminal:
79, 92, 105, 118, 131, 144, 157, 170, 183, 196, 209, 222, 235, 248, 261, and 274.
Although a counter-controlled loop is ideal for this task, you are not permitted to use a FOR loop in your
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 3 steps with 2 images
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
- Instructions for both assignments can be found in the picture linked to this post. The programs must be written in c++ and requires that the random number generator be seeded like this program: Program 3.25 // This program demonstrates random numbers. #include <iostream> #include <cstdlib> // For rand and srand #include <ctime> // For the time function using namespace std; int main() { // Get the system time. unsigned seed = time(0); // Seed the random number generator. srand(seed); // Display three random numbers. cout << rand() << endl; cout << rand() << endl; cout << rand() << endl; return 0; }arrow_forwardWrite a Python code This lab requires you to write a complete program using a condition controlled loop, a counter controlled loop, and an accumulator. The program is as follows: Write a program that will allow a grocery store to keep track of the total number of bottles collected for seven days. The program will calculate the total number of bottles returned for the week and the amount paid out (the total returned times .10 cents). The output of the program should include the total number of bottles returned and the total paid out. The program will ask the user if they have more data to enter and will end the program if they do not. Step 1: In the pseudocode below, declare the following variables under the documentation for Step 1. A variable called totalBottles that is initialized to 0 This variable will store the accumulated bottle values A variable called counter and that is initialized to 1 This variable will control the loop A variable called todayBottles…arrow_forwardWe learn about several types of loops. Describe specifically when it is appropriate to use: a for loop a while loop a do-while looparrow_forward
- For C Programming This has to deal with the Fibonacci sequence. Complete a program so that it prints the nth Fibonacci number, where n is an integer value read as input by the program. For example, if the input 4, then the output should be: Fibonacci number 4 is 3. Another example if the input is 7 then the output should be: Fibonacci number 7 is 13. Use a loop for this program.arrow_forwardFor Loop in Javaarrow_forwardComplete (in C++) the pseudocode below by including a SWITCH statement that takes the user input (an integer between 1-5) and prints out a count up in its English equivalent. For example: if the user inputs “1”, the code will print “one”, “two” on the next line, and so on up to “five”. If the user inputs “5”, the code will print “five” and finish. CREATE inputNum PRINT ("Please enter a number between 1-5 to start counting from:") READ inputNum WHILE inputNum >= 1 AND inputNum <= 5 BEGIN WHILE END WHILEarrow_forward
- What is the intuition behind using a loop statement? What do you gain from using loops in your code? How do you think loops in Python provide code reusability?arrow_forwardConsider the following common task done repeatedly:• Read the next input (x = read())• If the input is not valid (valid(x)), exit the loop• Print the input read (print(x))• Repeat the loopUsing C++ syntax:Write the loop above using a pretest loop, posttest loop and a user-located loop control mechanism. From the three which one is more readable and why?arrow_forwardI am having an issue with this program, I keep getting the number 15 everytime I type in a code. There is also the instructions for the module itself. //PSEUDOCODE //Write a program that prompts the user for a binary number //(from 3 to 8 bits) as a String and converts it to base-10 decimal value //There are several ways to do this in Java but your program must use a for loop and first principles to perform the conversion //Print the base-10 number when the loop ends public static void main(String args[]) { long sum = 0; System.out.println("Enter a binary number: "); Scanner scan = new Scanner(System.in); String s = scan.next(); long result = 0; for (int i = 0; i < s.length(); i++) { result = (long) (result + (s.charAt(1) - '0') * Math.pow(2, s.length()- i - 1)); scan.close(); } System.out.println(result); }}arrow_forward
- The following are some situations that might cause a change from the run state to the terminate state.arrow_forwardRewrite the following pseudocode segment using a loop structure. any language is fine, but don’t use gotos (Use Python or C++) i= 10; num = 0; loop: if i >= 20 then goto out i = i + 3; cout << i * num; goto loop out: cout << “DONE”;arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education