Question

In: Computer Science

Make a calculator in python that always gives an explanation when the answer is output. It...

Make a calculator in python that always gives an explanation when the answer is output. It must be detailed

Solutions

Expert Solution

The simple calculator program for python is given as follows:

----------------------------Code-----------------------------------------------------------------------

...
# Define again() function to ask user if they want to use the calculator again
def again():

# Take input from user
calc_again = input('''
Do you want to calculate again?
Please type Y for YES or N for NO.
''')

# If user types Y, run the calculate() function
if calc_again == 'Y':
calculate()

# If user types N, say good-bye to the user and end the program
elif calc_again == 'N':
print('See you later.')

# If user types another key, run the function again
else:
again()

# Call calculate() outside of the function
calculate()

---------------------------------------------------------------------------------------------------

The code is well explained by comments given by #.

----------------------------------------------Please Upvote-------------------------------------------------------------------------


Related Solutions

There is a special calculator that when used to add numbers up, it always rounds up...
There is a special calculator that when used to add numbers up, it always rounds up or down the number to the closest integer and ignore the decimals. For example, you want to add 1.1+2+3.6, it will show can calculate as 1+2+4, etc. Assume the error from each adding follows uniform distribution on (-0.5, 0.5). When adding 1500 numbers together, what is the probability of the absolute value of total error is greater than 15? How many numbers can you...
NPV always gives you correct decision for accepting the project. If NPV always gives us the...
NPV always gives you correct decision for accepting the project. If NPV always gives us the correct decision why should we pay attention to profitability ratios or IRR? Provide an example where one of these other ratios might change your decision on a project.
Please ANSWER ALL (explanation with or without BA 2 calculator greatly appreciated) #1. What is the...
Please ANSWER ALL (explanation with or without BA 2 calculator greatly appreciated) #1. What is the value today of a money machine that will pay $3,042.00 every six months for 11.00 years? Assume the first payment is made 5.00 years from today and the interest rate is 6.00% #2. What is the value today of a money machine that will pay $4,796.00 per year for 8.00 years? Assume the first payment is made today and that there are 8.0 total...
Answer true or false, with a brief explanation. 1. Monopolies are always bad for consumers. 2....
Answer true or false, with a brief explanation. 1. Monopolies are always bad for consumers. 2. The supply curve of a monopolist is upward sloping. 3. Monopolies charge the highest price a consumer is willing to pay, thus capturing all consumer surplus.
Please Use C language to Make a calculator. Make sure calculator is able to take up...
Please Use C language to Make a calculator. Make sure calculator is able to take up to 5 values. Try to make calculator using simple coding As you can. Please create a simple calculator with only +, -,* and divide. It has to be able to enter any numbers (including decimals) and be able to do the following functions: +, -, divide and multiply. Please have the answers, always rounded to two decimal figures. The calculator will also have to...
For an Independent Samples T-test, what are we looking for when the output gives us the...
For an Independent Samples T-test, what are we looking for when the output gives us the significance for Levene’s test for equal variance? Which significance value do we choose and when?
##### answer in python #####picture of output and input Create customer information system as follows: Ask...
##### answer in python #####picture of output and input Create customer information system as follows: Ask the user to enter name, phonenumber, email for each customer. Build a dictionary of dictionaries to hold 10 customers with each customer having a unique customer id. (random number generated) Take the keys of the above mentioned dictionary which are customer ids and make a list. Ask the use to enter a customer id and do a binary search to find if the customer...
Implement in Python using stack operations. Postfix Calculator Post fix calculator • We use a stack...
Implement in Python using stack operations. Postfix Calculator Post fix calculator • We use a stack • When an operand is read, push it on statck • When an operator is read i.e +, *. /, - – Pop two from the top of the stack and apply the operator and push the result on stack if there is one value instead of two display an error message • Keep repeating until an equal sign, = is read; pop from...
write a program to make scientific calculator in java
Problem StatementWrite a program that uses the java Math library and implement the functionality of a scientific calculator. Your program should have the following components:1. A main menu listing all the functionality of the calculator.2. Your program should use the switch structure to switch between various options of the calculator. Your Program should also have the provision to handle invalidoption selection by the user.3. Your calculator SHOULD HAVE the following functionalities. You can add any other additional features. PLEASE MAKE...
Please attach the output screenshots, narrative descriptions, or paste the Python codes when requested. Task 2...
Please attach the output screenshots, narrative descriptions, or paste the Python codes when requested. Task 2 We are producing two types of products, product A and product B. Product A is defective if the weight is greater than 10 lbs. Product B is defective if the weight is greater than 15 lbs. For a given product, we know its product_type and its weight. Design a program to screen out defective products. Starting the program with variable definition: product_type = 'xxx'...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT