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.4, Problem 16CP
What will the following code display?
number 1 = 10
number 2=5
number 1 = number 1 + number 2
print(number1)
print(number2)
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
What will the following code display?for number in range(2, 6):print(number)
What will the following code display?numbers = [10] * 5print(numbers)
What will the following code display?names = ['Jim', 'Jill', 'John', 'Jasmine']if 'Jasmine' not in names:print('Cannot find Jasmine.')else:print("Jasmine's family:")print(names)
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
// Superclass public class Vehicle { private double cost; public Vehicle (double c) { cost = c; } (Other method...
Starting Out with Java: From Control Structures through Objects (7th Edition) (What's New in Computer Science)
Briefly describe what is meant by memberwise assignment.
Starting Out with C++ from Control Structures to Objects (8th Edition)
Write a loop that counts the number of uppercase characters that appear in the String object str.
Starting Out with Java: From Control Structures through Data Structures (4th Edition) (What's New in Computer Science)
Write an SQL query to list each customer who bought at least one product that belongs to product line Basic in ...
Modern Database Management (12th Edition)
Suppose aList is an object of the class ArrayListString. How do you add the string Hello to the end of aList ?
Java: An Introduction to Problem Solving and Programming (8th Edition)
For each of the following activities, give a PEAS description of the task environment and characterize it in te...
Artificial Intelligence: A Modern Approach
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
- What will the value of the result variable be after the code segment below has been run. bool result ; int number3 = 17, number7 = 33; result = number3 > number7 ;arrow_forwardresult = half(number)8. What will the following code display?xdef display(x,y):return(x%2==0)print(display(4,7))print(display(7,4))arrow_forwardWhat will the value of the result variable be after the code segment below has been run. int result; int number3 = 48, number7 = 14; result = number3 * number7;arrow_forward
- What will the following Code segment print on the screen? int P = 30; int Q = 20; System.out.println("Your Total purchase is \n" + (Q*P) +" Dollars");arrow_forwardWhat will the value of the answer variable be after the code segment below has been run. int answer = -36; int number29 = 11, number24 = 8; answer += number29 * number24;arrow_forwardWhat does the following code display?values = [2] * 5print(values)arrow_forward
- use c# to do 1)Write an application that asks the user to enter two integers, obtains them from the userand displays the larger number followed by the words "is larger". If the numbers are equal, printthe message "These numbers are equal." 2)Write an application that reads an integer and determines and prints whether it is odd oreven. 3) Write a program, which uses a selection structure (if/else) to calculate and print the student grades. 80 and above is an A 60 and above is a B 50 and above is a C 35 and above is a D below 35 is failarrow_forwardHow many times would you see the asterisk shown in the following code? for (int x=1; x <= 100; x++) for (int y = 1; y <= 100; y++) for (int z = 1; z <= 100; z++) cout << " * ";arrow_forward*What will the value of the result variable be after the code segment below has been run. int number2 = 40;int result = 46; if( number2 <= 84 ){ result *= number2 ;}arrow_forward
- What will the following Code segment print on the screen? String LName = "FamilyName"; String FName = "GivenName"; System.out.println("Dear Mr " + LName); System.out.println("We would like to call you " + FName);arrow_forwardThe following code intends to input a user’s first name, last name, and age.However, it has an error. Fix the code.string fullName;int age;cout << "Enter your first and last name." << endl;cin >> fullName;cout << "Enter your age." << endl;cin >> age;cout << "You are " << age << " years old, " << fullName << endl;arrow_forward3.8: Software SalesA software company sells a package that retails for $99. Quantity discounts are given according to the following table:Quantity Discount10-19 20%20-49 30%50-99 40%100 or more 50%Write a program that asks the user to enter the number of packages purchased. The program should then display the amount of the discount (if any) and the total amount of the purchase after the discount. For instance, to calculate 20% of a value N, you can use the formula:(20 / 100.0) * N (or 0.2 * N).arrow_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,EBK JAVA PROGRAMMINGComputer ScienceISBN:9781337671385Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Python Tutorial #10; Math Functions in Python; Author: Art of Engineer;https://www.youtube.com/watch?v=OviXsGf4qmY;License: Standard YouTube License, CC-BY