Starting Out with Python (4th Edition)
4th Edition
ISBN: 9780134444321
Author: Tony Gaddis
Publisher: PEARSON
expand_more
expand_more
format_list_bulleted
Concept explainers
Expert Solution & Answer
Chapter 4, Problem 9MC
Program Description Answer
The abbreviated form of GIGO is “garbage in, garbage out”.
Hence, the correct answer is option “B”.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
Hi, I am trying to learn and execute a morse code in this way and by using this format, I already know another way and it works but it will be very helpful to understand this one as well, thanks.
def print_intro():
def get_input():
def encode(message):
def decode(message):
def process_lines(filename, mode):
def write_lines(lines):
def check_file_exists(filename):
def main():
calculate the number of memory bytes accessed by this program:
void my_dgemv(int n, double* A, double* x, double* y) {
double alpha=1.0, beta=1.0;
int lda=n, incx=1, incy=1;
cblas_dgemv(CblasRowMajor, CblasNoTrans, n, n, alpha, A, lda, x, incx, beta, y, incy);
}
Create a simple calculator which can perform basic arithmetic operations like addition, subtraction, multiplication, or division depending upon the user input in Bash shell scripting.
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...
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
- Java Program ASAP ************This program must work in hypergrade and pass all the test cases.********** The program down below does not work in Hypergrade and does not pass the test cases. Please modify it even more or create a new program so when I upload to hypergrade it passes the test cases. Thank you! For Test Case 1 first print out Please enter the file name or type QUIT to exit:\ then you type text1.txtENTER and it displays Stop And Smell The Roses./n there needs to be nothing after that. For test case 2 first print out Please enter the file name or type QUIT to exit: then you type txt1.txtENTER then it reads out File 'txt1.txt' is not found.\n Then it didplays Please re-enter the file name or type QUIT to exit:\n after the test file is not found. then you type in text1.txt and it displays stop and smell the roses.\n. For test case 3 first print out Please enter the file name or type QUIT to exit: then you type text2.txtENTER and it displays A true rebel you are!…arrow_forwardI having troubles running this C linux program. please use my code to fix any errors that need to be removed or added.If it needs sin() cos() tan() - Please adddisplayTriTab • Receive an integer called degrees that represents the number of degree for incrementation and return nothing. • Display the heading “--- TRIGONOMETRIC TABLE ---” center over the table •A blank line • Display the column headings as sown on the output. • A blank line. • Produce a table based from 0 to 360 degrees in increments based on the users input. • The table columns will be as follows: 1. Degrees ( Format: Right justified, no decimal places) 2. The radian value for the number of degrees in column 1 3. The sine value for the degrees in column 4. The cosine value for the degrees in column 5. The tangent value for the degrees in column 6. Tangent values for 90 and 270 will be infinity • The 360 degrees row will always be the last row even if the increment value entered would not [Bold] the code I do not…arrow_forwardJava Proram ASAP Please look closely at the circled parts in the failed test case. Improve and adjust the program which is down below with the futher moddifications because it does not pass the test cases in Hypergrade. Please remove /n from the program and for test case 4 after this line: Please re-enter the file name or type QUIT to exit:\n quitENTER there needs to be nothing. Also, I do not need file quit is no found in the program. import java.io.*;import java.util.Scanner;public class ConvertText { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(System.in); System.out.println("Please enter the file name or type QUIT to exit:"); while (true) { String input = sc.next(); if (input.compareTo("QUIT") == 0) { break; } else { // Get the absolute path of the current directory String filePath = new File("").getAbsolutePath(); filePath =…arrow_forward
- Need help with Python....please paste indented code here 4. Implement the following to simulate how websites ensure that everyone has a unique username.a) Make a list of five or more usernames called current_users.b) Request an input of username.c) Print a message, Sorry XXX, that name is taken and also display the current user list if the inputusername has already been used. XXX is the input user name.d) Print a message, Great, XXX is still available and also display the updated user list if the username hasnot been used.e) Make sure your comparison is case insensitive. If 'John' has been used, 'JOHN' or ‘john’ should not beaccepted.Example Output 1Enter your user name: TOMSorry TOM, that name is taken.Current users: [‘admin’, ‘tom’, ‘jerry’, ‘Dora’, ‘GEORGE’] Example Output 2 Enter your user name: curiousGeorge Great, curiousGeorge is still available. Updated users: [‘admin’, ‘tom’, ‘jerry’, ‘Dora’, ‘GEORGE’, ‘curiousGeorge’] 5. Implement the following to search a…arrow_forwardQUESTION AND COLLEGE COMPILER OUTPUT ATTACHED IN IMAGE . PLEASE SEE AND MY SOLUTION TO THE PROBLEM IS GIVEN BELOW. ------------MY SOLUTION---------- MAIN.CPP #include <iostream> #include "HPVISACard.cpp"#include <sstream> using namespace std; int main() {// Declare variablesstring type;double amount;int rewardPercentage,choice;// print menucout<<"Menu"<<"\n1.VISA Card"<<"\n2.HPVISA Card"<<endl; // ask user to enter his choicecout<<"Enter the choice"<<endl;cin>>choice;// conditionally execute based on user choiceswitch(choice){// case 1case 1:{// ask user to enter transaction typecout<<"Enter the transaction type"<<endl;cin>>type; // ask user to enter transaction amountcout<<"Enter the transaction amount"<<endl;cin>>amount; // ask user to enter reward pointscout<<"Enter the reward points"<<endl;cin>>rewardPercentage;// create VISACard class object using parameterized…arrow_forwardEditable source code: #include<stdio.h> int isEven(int); int main(void) { // TODO: Write your code here return 0;} int isEven(int n) { return n % 2 == 0;} The instructions is on the photo as well as the expected outputarrow_forward
- Create a main( ) java file to perform the required tasks. Validate a user’s input (a menu option) to ensure its validity. Test and document your program to make sure that all of the required tasks are met. The main( ) creates a menu for a bank manager and a bank customer. For a bank manager, he/she can add information of bank customers and display all customer records. For a bank customer, he/she can make a deposit to a bank account and withdraw money from the account. Hint: The main ( ) could have a static method that allows a bank manager to add customers’ information to a text file. The information consists of Customer ID, Name (full name), and Email Address. Note that a loop should be used to perform the manager's task. As a result from the process, a text file "BankCustInfo.txt" is created. Also, the main( ) could have another static method that allows the bank manager to display all customer records to the screen. Create a class, BankCustomer, that contains attributes such as…arrow_forwardA sample run of your program should look like below. Note that the user’s inputs are highlighted inbold.Enter an input file: proj1_test_case.txt--------------------------------------------------Course Report Options--------------------------------------------------1. Print in numerical average order2. Print in first name order3. Print course statistics4. Record FinderChoose any other option to quit.--------------------------------------------------Selection: 2----------------------------------------------------------------------------------------------------Course Report: First Name Order--------------------------------------------------Ana 1500 - 80.00 (B) (rank: 3)Ana 2000 - 100.00 (A) (rank: 1)Diego 2500 - 50.00 (F) (rank: 5)Lee 3000 - 80.00 (B) (rank: 3)Sarah 1000 - 88.05 (B) (rank: 2)----------------------------------------------------------------------------------------------------Course Report Options--------------------------------------------------1. Print in numerical average…arrow_forwardRGB LED fading colors project. Write comments for the below C code explaining each line. Code is below ?? #define GREEN 5 #define BLUE 3 #define RED 6 void setup() { pinMode(RED, OUTPUT); pinMode(GREEN, OUTPUT); pinMode(BLUE, OUTPUT); digitalWrite(RED, HIGH); digitalWrite(GREEN, LOW); digitalWrite(BLUE, LOW); } int redValue; int greenValue; int blueValue; void loop() { for( int i=0; iarrow_forward
- Forgetting a semi-colon at the end of a statement or misspelling a certain command is an example of Select one: a. compile error b. logical error c. runtime error d. computer error It is an extremely fast computer, which can execute hundreds of millions of instructions per second. Select one: a. all of the choices b. minicomputer c. supercomputer d. mainframe computer Refers to a single user computer system having moderately powerful processor. Select one: a. mainframe computer b. PC c. minicomputer d. workstationarrow_forwardJava Program ASAP ************This program must work in hypergrade and pass all the test cases.********** Please give me a new program becausse when I upload the program to hypergrade it does not pass the test cases. It says 1 out of 4 passed. Thank you! For Test Case 1 first print out Please enter the file name or type QUIT to exit:\ then you type text1.txtENTER and it displays Stop And Smell The Roses./n there needs to be nothing after that. For test case 2 first print out Please enter the file name or type QUIT to exit: then you type txt1.txtENTER then it reads out File 'txt1.txt' is not found.\n Then it didplays Please re-enter the file name or type QUIT to exit:\n after the test file is not found. then you type in text1.txt and it displays stop and smell the roses.\n. For test case 3 first print out Please enter the file name or type QUIT to exit: then you type text2.txtENTER and it displays A true rebel you are! Everyone was impressed. You'll do well to continue in…arrow_forwardI am having trouble running this code properly, I believe it has something to do with the location of my board.dat file, but am unsure how to exactly fix it. Upon running the code, I can not open file error. Attached is an image of what my board.dat text file looks like that is located on my desktop. #include<iostream> #include<fstream> #include<string.h> using namespace std; // function prototypes void Fire(char board[][25]); void FleetSunk(char board[][25], int&); int main() { // declaring board char board[25][25]; ifstream infile; // opening the input file infile.open("board.dat"); if (!infile) { cout << "Can not open file." << endl; } // taking input from file for (int i = 0; i < 25; i++) { for (int j = 0; j < 25; j++) { char bS; infile >> bS; board[i][j] = bS; } } int fS = 0; // calling functions do { Fire(board); FleetSunk(board, fS); } while (fS == 0); system("PAUSE"); } void Fire(char board[25][25]) { int row =…arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Programming Logic & Design ComprehensiveComputer ScienceISBN:9781337669405Author:FARRELLPublisher:CengageEBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT