Python Programming: An Introduction to Computer Science, 3rd Ed.
3rd Edition
ISBN: 9781590282755
Author: John Zelle
Publisher: Franklin, Beedle & Associates
expand_more
expand_more
format_list_bulleted
Expert Solution & Answer
Chapter 7, Problem 1D
a)
Explanation of Solution
Simple decision:
- In python, decisions can be implemented using “if” statements.
- Python handles the following type of decisions,
- Simple decision
- Two-way decision
- Multi-way decision
- Simple decisions can be implemented by a simple “if” statement.
- Example:
#Initialize the variable
a=1
#Check the condition using “if” statement
if (
b)
Explanation of Solution
Two-way decision:
- In python, decisions can be implemented using “if” statements.
- Python handles the following type of decisions,
- Simple decision
- Two-way decision
- Multi-way decision
- Two-way decisions can be implemented by “if-else” statement.
- Example:
#Initialize the variables
a=5
b=3
#Check the condition using “if” statement
if(a<b):
�...
c)
Explanation of Solution
Multi-way decision:
- In python, decisions can be implemented using “if” statements.
- Python handles the following type of decisions,
- Simple decision
- Two-way decision
- Multi-way decision
- Multi-way decision can be implemented by “if-elif-else”, and nested “if-else” statements.
- Example:
#Initialize the variables
a=5
b=3
c=6
#Check the condition using “if” statement
if(a<b && a<c):
#Print “a” value
print(a)
#Check the condition using “elif” statement
elif(b<c):
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
How can the decision maker choose a satisfactory decision?
Create a Decision Tree from the following Decision table.
Actions/Conditions
Rules
Requester is authorized
Y
Y
Y
Y
Chemical is available
Y
Y
Y
Conditions
Chemical is hazardous
Y
Y
Requester is trained
Y
Accept request
Actions
Reject request
OFocus
近
How can the decision maker make a choice that is satisfactory?
Chapter 7 Solutions
Python Programming: An Introduction to Computer Science, 3rd Ed.
Ch. 7 - Prob. 1TFCh. 7 - Prob. 2TFCh. 7 - Prob. 3TFCh. 7 - Prob. 4TFCh. 7 - Prob. 5TFCh. 7 - Prob. 6TFCh. 7 - Prob. 7TFCh. 7 - Prob. 8TFCh. 7 - Prob. 9TFCh. 7 - Prob. 10TF
Ch. 7 - Prob. 1MCCh. 7 - Prob. 2MCCh. 7 - Prob. 3MCCh. 7 - Prob. 4MCCh. 7 - Prob. 5MCCh. 7 - Prob. 6MCCh. 7 - Prob. 7MCCh. 7 - Prob. 8MCCh. 7 - Prob. 9MCCh. 7 - Prob. 10MCCh. 7 - Prob. 1DCh. 7 - Prob. 2DCh. 7 - Prob. 3DCh. 7 - Prob. 1PECh. 7 - Prob. 2PECh. 7 - Prob. 3PECh. 7 - Prob. 4PECh. 7 - Prob. 5PECh. 7 - Prob. 6PECh. 7 - Prob. 7PECh. 7 - Prob. 8PECh. 7 - Prob. 9PECh. 7 - Prob. 10PECh. 7 - Prob. 11PECh. 7 - Prob. 12PECh. 7 - Prob. 13PECh. 7 - Prob. 14PECh. 7 - Prob. 15PECh. 7 - Prob. 16PECh. 7 - Prob. 17PECh. 7 - Prob. 18PE
Knowledge Booster
Similar questions
- Draw a pseudocode, decision table and decision tree from the following scenario. Students are awarded the following grades: If the pass mark is less than or equal to 40 = Fail If the pass mark is 41 and less than or equal to 60 = pass If the mark is 61 and less than or equal to 85 = merit If the mark is 86 and over = distinctionarrow_forwardDiscrete Mathematics: Use truth tables to establish the truth of the statement. "A conditional statement is not logically equivalent to its inverse."arrow_forwardMultiple Choice Question, Pls select all that apply...arrow_forward
- Which is the best way to go for Game playing problem?(a) Linear approach (b) Heuristic approach (c) Random approach (d) Stratified approach.arrow_forwardin decision table if it has 3 questions it must contain ... answers .... .... .. 6. 3 9. 8 Oarrow_forwardWhat is the term used for describing the judgmental or commonsense part of problem solving? A. Heuristic B. Critical C. Value based D. Analytical E. None of the abovearrow_forward
- A7. If you are developing a software for online shopping, then which decision table create to implement your logic? you will A. Table consists of seller behavior B. Table consists of workers salary C. Table consists of Discount rules D. Table consists of workers commission W hp 近arrow_forwardComputer Science Consider each of the following four sentences and say whether they would typically be used to make a statement or not to make a statement: Where is it? There it is! Watch out! It's coming toward us too fast! If the if-part of a conditional claim is true, and if the conditional claim itself is true, will the then-part have to be true? (draw and use the truth table for the conditional in your answer)arrow_forwardIs there a role for intuition in the decision-making process, or should all judgments be made strictly on the numbers? Explain your answer.arrow_forward
- Indicate the most appropriate if-then statement that the English sentence represents: People 18 or older can vote in a Federal election. A. No if-then statement would cover this situation. B. If a person is 18 years old or older, then the person can vote in Federal elections. C. If a person does not vote in a Federal election, they are not 18 years old or older. D. If a pers is 18 years old or younger, then the person can vote in Federal elections.arrow_forwardQuestion 25 The following two statements are logically equivalent: (p → q) ∧ (r → q) (p ∧ r) → q You can use truth tables to determine equivalency Group of answer choices True Falsearrow_forwardWhich of the following statements is true regarding choosing the machine learning approach? * a) If we have a target variable, we use unsupervised learning b) If we have a target variable, we use supervised learning c) If we have a target variable, we use either supervised learning or unsupervised learning d) A decision cannot be made between supervised or unsupervised learning on the basis of the target variable.arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Principles of Information Systems (MindTap Course...Computer ScienceISBN:9781285867168Author:Ralph Stair, George ReynoldsPublisher:Cengage LearningFundamentals of Information SystemsComputer ScienceISBN:9781305082168Author:Ralph Stair, George ReynoldsPublisher:Cengage LearningEBK JAVA PROGRAMMINGComputer ScienceISBN:9781305480537Author:FARRELLPublisher:CENGAGE LEARNING - CONSIGNMENT
Principles of Information Systems (MindTap Course...
Computer Science
ISBN:9781285867168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
Fundamentals of Information Systems
Computer Science
ISBN:9781305082168
Author:Ralph Stair, George Reynolds
Publisher:Cengage Learning
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781305480537
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT