Magic calculator or MagiCal is not a regular calculator! MagiCal has special features as follows: ...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Magic calculator or MagiCal is not a regular calculator! MagiCal has special features as follows: • It only accept four operators: Addition, Subtractoin, Multiplication and Division. . It only accepts integer numbers between 0 (inclusive) and 100 (inclusive) as input. • MagiCal should know how many operations it will perform. It takes this information from the user displaying the message 'Hi, how many operations do you want MagiCal to perform?\n'. Let's assume the user-provided number is k. Now, MagiCal asks the user for k times to provide the operator and two integer numbers as described below: - It prints a message 'Select the operator from the list of Addition (1), Subtraction (2), Multiplication (3), Division (4):\n'. Based on the user-provided input there should be two types of responses from MagiCal: If the user enters a valid input, 1, 2 3 or 4, then, the user will be asked to enter two numbers as the operands of the provided operator, as described below. For any invalid output the magic calculator should notify the user with the message 'Invalid input!". To take the first integer number MagiCal displays the message 'Enter the first number in the interval of [0,100]:\n'. After entering the first number, MagiCal will ask for the second integer number using the message 'Enter the second number in the interval of [0,100]:\n'. If one or both of the provided numbers are not in the specified interval MagiCal will show 'Magic calculator can not perform your operation!', and proceeds for the next operation. If there is not any operation remaining, the program terminates. - Finally, if two numbers are in the specified interval MagiCal applies the operator received in the first step and shows the result in the format of 'first_number operator second_number result'. Note that if the user-provided operator is division and the second number is 0, MagiCal should display the message 'The denominator cannot be 0.'. op = input('Hi, how many operations do you want MagiCal to perform?\n') k = int(input('Select the operator from the list of Addition (1), Subtraction (2), Multiplication (3), Division (4):\n')) if k != ['1', '2', '3', '4']: print('Invalid input!') Felse: number1= input('Enter the first number in the interval of [0, 100]:\n') number2 = input('Enter the second number in the interval of [0,100]:\n') if number1 == range [0, 100] and number2 pass else: == range [0, 100]: print('Magic calculator can not perform your operation!') A2 A1 A Magic calculator or MagiCal is not a regular calculator! MagiCal has special features as follows: • It only accept four operators: Addition, Subtractoin, Multiplication and Division. . It only accepts integer numbers between 0 (inclusive) and 100 (inclusive) as input. • MagiCal should know how many operations it will perform. It takes this information from the user displaying the message 'Hi, how many operations do you want MagiCal to perform?\n'. Let's assume the user-provided number is k. Now, MagiCal asks the user for k times to provide the operator and two integer numbers as described below: - It prints a message 'Select the operator from the list of Addition (1), Subtraction (2), Multiplication (3), Division (4):\n'. Based on the user-provided input there should be two types of responses from MagiCal: If the user enters a valid input, 1, 2 3 or 4, then, the user will be asked to enter two numbers as the operands of the provided operator, as described below. For any invalid output the magic calculator should notify the user with the message 'Invalid input!". To take the first integer number MagiCal displays the message 'Enter the first number in the interval of [0,100]:\n'. After entering the first number, MagiCal will ask for the second integer number using the message 'Enter the second number in the interval of [0,100]:\n'. If one or both of the provided numbers are not in the specified interval MagiCal will show 'Magic calculator can not perform your operation!', and proceeds for the next operation. If there is not any operation remaining, the program terminates. - Finally, if two numbers are in the specified interval MagiCal applies the operator received in the first step and shows the result in the format of 'first_number operator second_number result'. Note that if the user-provided operator is division and the second number is 0, MagiCal should display the message 'The denominator cannot be 0.'. op = input('Hi, how many operations do you want MagiCal to perform?\n') k = int(input('Select the operator from the list of Addition (1), Subtraction (2), Multiplication (3), Division (4):\n')) if k != ['1', '2', '3', '4']: print('Invalid input!') Felse: number1= input('Enter the first number in the interval of [0, 100]:\n') number2 = input('Enter the second number in the interval of [0,100]:\n') if number1 == range [0, 100] and number2 pass else: == range [0, 100]: print('Magic calculator can not perform your operation!') A2 A1 A
Expert Answer:
Answer rating: 100% (QA)
Heres the implementation in Python printHi how many operations do you want MagiCal to perform ... View the full answer
Related Book For
Management Accounting
ISBN: 978-0132570848
6th Canadian edition
Authors: Charles T. Horngren, Gary L. Sundem, William O. Stratton, Phillip Beaulieu
Posted Date:
Students also viewed these programming questions
-
You are given the following pseudocode for an algorithm: 1 method1(n) 123 if n==0 2 3 return 0 45 else 5 return method2(n-1, n-1) - (n-1) 6 method2 (m, k) if m==0 return method1(k) 7 8 9 else 10...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
Goals of this unit: 1. construct cogent, logical, effective, and ethical arguments in writing; 2. compose texts that effectively employ the features of a given genre; 3. identify reliable and...
-
1. Prepare a schedule of cost of goods manufactured for Denim Bones for the year ended December 31, 2024. 2. Prepare an income statement for Denim Bones for the year ended December 31, 2024. 3. How...
-
Determine the rate of change HG of the angular momentum HG of rod AB of Prob.18.3 A 12 in. 12 in. 20 B
-
The 2021 income statement of Adrian Express reports sales of $19,310,000, cost of goods sold of $12,250,000, and net income of $1,700,000. Balance sheet information is provided in the following...
-
Grandview Global Financial Services is an international corporation providing multiple financial services. Although it is one of the smaller players in the field, the firm has about 20,000 employees...
-
Is it possible to establish formal organizational procedures (either at the project level or company-wide) for the resolution of conflicts? If a procedure is established, what can go wrong?
-
vj An drop of ink, with m = 1.25x10-8 g enters the nozzle region, with a uniform electric field as shown in the figure, with v; = 17 m/s and E = 6.9x10 N/C. The vertical length of the nozzle plates...
-
Aggie Oil Corporation, a new successful efforts company, incurred the following costs and made the other transactions shown below for the years 2018 and 2019. 2018 a. Paid $225,000 for G&G costs...
-
Accrual basis of accounting is not used in governmental entities because they use modified accrual basis of accounting. a. TRUE b. FALSE 11) Which one among these is not a characteristic of a fund?...
-
Maurice, Jennifer, Natasha, and Sinbad just graduated from their business program at Mohawk College and decided to go into business together. Each individual invested funds in the ration of 4:7:3:6,...
-
Explain three sources of short-term finance used by a company and why these sources are important. Define Working Capital & its importance.
-
Practice IRV Problems Gross Potential Rental Income (if all units rented) - Vacancy and Collection Loss Miscellaneous Income = Effective Gross Income - Operating Expenses = Net Operating Income (NOI)...
-
Describe one of these three terms and explain its influence on the financial statements. Include a numerical example to prove your points. Participate in follow-up discussion by reading classmates'...
-
Marigold Corporation uses a perpetual inventory system and had inventory worth $73,500 at the beginning of the year. Purchases were made during the year for $323,000; however, 10% of these goods were...
-
Chapter 16: Process Costing In a process cost system, costs are assigned only to a. work in process, finished goods, and cost of goods sold. b. one work in process account. c. work in process and...
-
2. In the circuit given in Figure 2, i,(t) = 5.67cos(5t)A and v (t) = 70.71 cos(5t 60) V a) Find the equivalent load impedance. State whether the load is inductive or capacitive. b) Calculate the...
-
What is the major benefit of the ROI technique for measuring performance?
-
Thomas bought a new truck in Calgary with a list price, including options, of $21,000. The dealer had given her a generous trade-in allowance ?of $5,000 on her old truck that had a wholesale price of...
-
Martina Stemmler, president of Evert Tool Co., has asked for information about the cost behaviour of manufacturing support costs. Specifically, she wants to know how much support cost is fixed and...
-
Distinguish between a heat engine, a heat pump, and a refrigerator.
-
Sketch and explain split air conditioner?
-
With a neat sketch of a room air-conditioner, explain its working principle.
Study smarter with the SolutionInn App