1) For each of the test data values, what code was executed in each of the...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1) For each of the test data values, what code was executed in each of the four types of if statements? 2) Were there any incorrect conditional statements? If so, which statements were incorrect and how could they be corrected? 2) For each of the test data values, what code was executed in the logical operators code? 3) Are there any logical operator statements that could never be True? If so, explain why. print("\nNested if") if input_num >= 50: if input_num <= 100: print('Number input is between 50 and 100') print('Number input is greater than 100') if input_num >= 25: print('Number input is between 25 and 50') else: print('Number entered is less than 25') else: else: print("\nLogical operators') if input_num >= 50 and input_num <= 100: print('Number input is between 50 and 100') if input num >= 50 or input num <= 100: print('??') if input_num <= 50 or input_num >= 100: print('Number input is not between 50 and 100') if input_num <= 50 and input_num >= 100: print('??') if not input_num > 0: print('??') Test data: Execute the program four times each time using one of the test data values below: -1, 25, 50, 101 Code: input_num= int(input('Enter an integer value: ')) print('Simple if) #simple if if input_num > 50: print(input_num, 'is greater than 50') print("\nif/else') if input_num > 50: print(input_num, 'is greater than 50') else: print(input_num, print("\nif/elif/else') 'is not greater than 50') if input_num < 0: print('Number input is negative') elif input_num < 50: print("Number input is greater than or equal to 0 and less than 50') elif input_num < 100: print('Number input is greater than or equal to 50 and less than 100') else: print('Number input is greater than or equal to 100') 1) For each of the test data values, what code was executed in each of the four types of if statements? 2) Were there any incorrect conditional statements? If so, which statements were incorrect and how could they be corrected? 2) For each of the test data values, what code was executed in the logical operators code? 3) Are there any logical operator statements that could never be True? If so, explain why. print("\nNested if") if input_num >= 50: if input_num <= 100: print('Number input is between 50 and 100') print('Number input is greater than 100') if input_num >= 25: print('Number input is between 25 and 50') else: print('Number entered is less than 25') else: else: print("\nLogical operators') if input_num >= 50 and input_num <= 100: print('Number input is between 50 and 100') if input num >= 50 or input num <= 100: print('??') if input_num <= 50 or input_num >= 100: print('Number input is not between 50 and 100') if input_num <= 50 and input_num >= 100: print('??') if not input_num > 0: print('??') Test data: Execute the program four times each time using one of the test data values below: -1, 25, 50, 101 Code: input_num= int(input('Enter an integer value: ')) print('Simple if) #simple if if input_num > 50: print(input_num, 'is greater than 50') print("\nif/else') if input_num > 50: print(input_num, 'is greater than 50') else: print(input_num, print("\nif/elif/else') 'is not greater than 50') if input_num < 0: print('Number input is negative') elif input_num < 50: print("Number input is greater than or equal to 0 and less than 50') elif input_num < 100: print('Number input is greater than or equal to 50 and less than 100') else: print('Number input is greater than or equal to 100')
Expert Answer:
Answer rating: 100% (QA)
Analyze the behavior for each of the test data values 1 25 50 and 101 1 For each of the test data values what code was executed in each of the four types of if statements For inputnum 1 Simple if prin... View the full answer
Related Book For
Management Accounting Information for Decision-Making and Strategy Execution
ISBN: 978-0137024971
6th Edition
Authors: Anthony A. Atkinson, Robert S. Kaplan, Ella Mae Matsumura, S. Mark Young
Posted Date:
Students also viewed these programming questions
-
5. Atom-bomb blast cloud. What is the time-dependence of the radius R(t) of the blast cloud? Hint: Consider the physical variables that include energy released (E). Tailor did atom-bomb blast cloud...
-
List three specific parts of the Case Guide, Objectives and Strategy Section (See below) that you had the most difficulty understanding. Describe your current understanding of these parts. Provide...
-
1. How strong are the competitive forces confronting J. Crew in the market for specialty retail? Do a [Michael Porter] five-forces analysis to support your answer. (see chapter 3 in the textfor...
-
Use a computer and generate 50 random samples, each of size n = 28, from a normal probability distribution with = 19 and = 4. a. Calculate the z corresponding to each sample mean that would result...
-
The significance of financial statement data is not in the amount alone. Discuss the meaning of this statement.
-
What are some examples of variable consideration? What are the two approaches for estimating variable consideration?
-
Draw energy diagrams for the person and the package in Figure 10.21 . Figure 10.21 Two equivalent situations in which an object is accel- erated by static friction. (a) Person steps forward from...
-
At December 31, 2013, Weiss Imports reported this information on its balance sheet. Accounts receivable $600,000 Less: Allowance for doubtful accounts 37,000 During 2014, the company had the...
-
(a) The Treasury desk of a global bank incorporated in UK wants to invest GBP 200 million on 1st January, 2019 for a period of 6 months and has the following options: (1) The Equity Trading desk in...
-
Diamant Foods Company produces a variety of food products, including a line of candies. One of its most popular candy items is Divine Diamonds, a bag of a dozen individually wrapped diamond-shaped...
-
Amos Co. is the defendant in several lawsuits: Estimated probability of loss Estimated amount of loss Lawsuit #1 5% $23 million Lawsuit #2 35% $13 million Lawsuit #3 80% $0 to $16 million Lawsuit #4...
-
How do the location and size of warehouses affect the performance of a firm such as IKEA? What factors should IKEA consider when deciding where and how big its warehouses should be?
-
Define the key performance metrics for sourcing and discuss its role in creating strategic fit between the supply chain strategy and the competitive strategy.
-
Understand decision tree methodologies used to evaluate supply chain design decisions under uncertainty.
-
Define relevant risks and explain different strategies that may be used to mitigate risk in global supply chains.
-
Identify factors that need to be included in total cost when making global sourcing decisions.
-
Given the data below, calculate y(3.4) using 3rd degree Newton interpolation. X y 2.5 7 3 8 4 2 5 1
-
The vapor pressure of the liquid NH, is measured at different temperatures. The following vapor pressure data are obtained. Temperature, K P, mmHg 217.1 223.4 234.7 588.1 Calculate the enthalpy of...
-
Stan's, a department store chain, has conducted a survey to collect data on customer satisfaction and perception of its merchandise and service. Data for responses to the question "How likely is it...
-
Read the Wall Street Journal article Survival Strategies: After Cost Cutting, Companies Turn toward Price Increases by Timothy Aeppel (September 18, 2002, p. A1). The article reports an all-out...
-
For many years, automobile companies were highly decentralized in terms of functions. The most obvious effect of this heavy decentralization of function was apparent when all the groups needed to...
-
Find the value of z 0.10 . Approach We wish to find the z-value such that the area under the standard normal curve to the right of the z-value is 0.10.
-
The scores earned on the mathematics portion of the SAT, a college entrance exam, are approximately normally distributed with mean 516 and standard deviation 116. What scores separate the middle 90%...
-
The heights of a pediatricians three-year-old females are approximately normally distributed, with mean 38.72 inches and standard deviation 3.17 inches. Find the height of a three-year-old female at...
Study smarter with the SolutionInn App