Write a function called "check_answer" which will determine if a given addition or subtraction problem was solved correctly. Here's the IPO notation for the function: =function: input: = check_answer two numbers (number1 & number2, both integers); an answer (an integer) and an operator (+ or -, expressed as a String) processing: determines if the supplied expression is correct, for example, if the operator is", number11. number22 and answer 3 then the expression is correct returns True if the expression is correct, False if it is not correct Here's a sample program that you can use to test your function: answer check answer (1, 2, 3, 4) print (answer1) answer2 check, answer (1. 2. -1.) print (answer2) answer3 check answer(9,5, 3, "") print (answer 3) answer4 check answer (8, 2, 4, print (answer4) And here's the expected output: True
Write a function called "check_answer" which will determine if a given addition or subtraction problem was solved correctly. Here's the IPO notation for the function: =function: input: = check_answer two numbers (number1 & number2, both integers); an answer (an integer) and an operator (+ or -, expressed as a String) processing: determines if the supplied expression is correct, for example, if the operator is", number11. number22 and answer 3 then the expression is correct returns True if the expression is correct, False if it is not correct Here's a sample program that you can use to test your function: answer check answer (1, 2, 3, 4) print (answer1) answer2 check, answer (1. 2. -1.) print (answer2) answer3 check answer(9,5, 3, "") print (answer 3) answer4 check answer (8, 2, 4, print (answer4) And here's the expected output: True
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 1 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.Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr