Provide the code before and after the fix

Assignment Help Financial Management
Reference no: EM132382389

Question

#Print the welcome message and menu list

print("Welcome to the Python Calculator Application.")

print("Addition or Subtraction ")

print("1) Addition (+)")

print("2) Subtraction (-)")

#Take user choice

userChoice = input("Enter 1 or 2 indicating your selection.")

#Check if user choice is addition

if(userChoice == "1"):

print("Addition was selected.")

first = int(input("Enter your first integer:"))

second = int(input("Enter your second integer:"))

print("Addition of "+str(first)+" and "+str(second)+" is : "+str(first+second))

#Check if user choice is Subtraction

elif(userChoice=="2"):

print("Subtraction was selected.")

first = int(input("Enter your first integer:"))

second = int(input("Enter your second integer:"))

print("Difference of "+str(first)+" and "+str(second)+" is : "+str(first-second))

while True:

try:

NUM1 = int(input("Please enter the first integer.n"))

NUM2 = int(input("Please enter the second integer.n"))

break

except ValueError:

print('Please enter a whole number')

print("nThe smallest number is " + str(min(int(NUM1), int(NUM2))))

print("The largest number is " + str(max(int(NUM1), int(NUM2))))

print("nProgram finished.")

Use one or more python validation techniques provided and fix your code to gracefully and securely handle user input errors.

Just pick a smaller section of the code to fix. Provide the code before and after the fix. Be sure to demonstrate the new fix works as expected by providing screen captures.

Reference no: EM132382389

Questions Cloud

Find the upper and lower control limits : The average pole was 3 yards in length and the average sample range was 0.015 yard. Find the 89% upper and lower control limits.
Perform the update a bird function for a specific state : Generate an appropriate Welcome, prompt, and exit messages to help the user navigate the program. The program should continue to allow selections.
How can you prove that organizational culture is strong : 1. In what ways cultural values are transmitted to employees? 2. How can you prove that organizational culture is strong?
Individuals to be successful leaders in sport organizations : What traits are necessary for individuals to be successful leaders in sport organizations? Give an example of someone you believe
Provide the code before and after the fix : Use one or more python validation techniques provided and fix your code to gracefully and securely handle user input errors.
One thousandth of a second per step : Why do you think that Nike specify the time for each step in making their products down to one thousandth of a second per step?
Design an application to facilitate the estimating process : Assignment - VBA and Spreadsheet - Your objective is to design an application to facilitate the estimating process for IndCon
Write a program that prompts user to enter positive integer : Write a program that prompts the user to enter a positive integer and prints the largest just number that is less than or equal to the user's input.
Future application of artificial intelligent systems : Prepare a presentation showing Recent/Future application of (Artificial) Intelligent Systems - discuss about the pro and cons of that with references

Reviews

Write a Review

Financial Management Questions & Answers

  Auto insurance coverage

Kurt Simmons has 55/105/15 auto insurance coverage. What amount will the insurance company pay for the damages?

  Cash flows are expected to have zero growth rate

What is the firm's value if cash flows are expected to have a zero growth rate from now to infinity?

  Executives and traders have for dealing with wrongdoing

The Senate recently released a report on wrongdoing at JP Morgan Chase. What options did the executives and traders have for dealing with this wrongdoing?

  Unsure about the assumptions of a growth rate

The Yurdone Corporation wants to set up a private cemetry business. According to the CFO, Barry M. Deep, business is "looking up". The company is somewhat unsure about the assumptions of a growth rate of 5.7 percent its cash flows. At what constant g..

  Why do reports prefer formal style than other business

Why do reports prefer formal style than other business documents or informal? how is formal report different than informal?

  Calculate present value of the cash inflows of project

If the company requires a return of 10 percent for such an investment, calculate the present value of the cash inflows of the project.

  What return did you realize on one-year investment

You are buying from the financially questionable ABC Capital Corp. What return did you realize on this one-year investment?

  Which the broker claims is fantastic bargain

Your friend Marvin is excited because he believes he’s found an investment bargain. Marvin knows you’re finance major and has asked your opinion of opportunity.

  Amount of private mortgage insurance

So what is the loan balance at the end of 10 years of scheduled payments? And what is the amount of private mortgage insurance added to each payment in the first year?

  Comment on the age of the assets given the data

Comment on the age of the assets given the data.

  Calculate simple payback for high efficiency clothes washer

determine the least cost option for satisfying the clothes-washing requirement. Calculate simple payback for the high efficiency clothes washer.

  What is your estimate of the stocks current value

Sawchuck Consulting has been profitable for the last 5 years, but it has never paid a dividend. Management has indicated that it plans to pay a $0.25 dividend 3 years from today, then to increase it at a relatively rapid rate for 2 years, and then to..

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd