1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Tju [1.3M]
3 years ago
10

Ill give 100 points to whoever gives me the CORRECT answer. I keep getting syntax errors when I do the "add:" part. Can someone

walk me through this code?
Part A One of the biggest benefits of writing code inside functions is that we can reuse the code. We simply call it whenever we need it! Let’s take a look at a calculator program that could be rewritten in a more reusable way with functions. Notice that two floats (decimal numbers, but they can also include integers) are inputted by the user, as an operation that the user would like to do. A series of if statements are used to determine what operation the user has chosen, and then, the answer is printed inside a formatted print statement. num1 = float(input("Enter your first number: ")) num2 = float(input("Enter your second number: ")) operation = input("What operation would you like to do? Type add, subtract, multiply, or divide.") if operation == "add": print(num1, "+", num2,"=", num1 + num2) elif operation == "subtract": print(num1, "-", num2,"=", num1 - num2) elif operation == "multiply": print(num1, "*", num2,"=", num1 * num2) elif operation == "divide": print(num1, "/", num2,"=", num1 / num2) else: print("Not a valid operation.") Your job is to rewrite the program using functions. We have already looked at a function that adds two numbers. Using that as a starting point, we could call the add function from within our program in this way: if operation == “add”: result = add(num1, num2) print(num1, "+", num2,"=",result) Now it’s your turn to do the following: Type all of the original code into a new file in REPL.it. Copy the add function from the unit and paste it at the top of your program. Write 3 additional functions: subtract, multiply, and divide. Pay careful attention to the parameters and return statement. Remember to put the three functions at the top of your Python program before your main code. Rewrite the main code so that your functions are called. Part B There are many different ways that a user could tell us that he or she would like to add two numbers in our calculator program. The user could type “add”, “Add”, “ADD”, or “+”, to name a few possibilities. Of cour
Computers and Technology
2 answers:
sertanlavr [38]3 years ago
7 0

working on rewriting my code so i can paste it here! itll be done in a sec

Olin [163]3 years ago
6 0

Answer:

sorry but there is not enough information to complete this

Explanation:

You might be interested in
Question #2
Softa [21]

Hofstede's cultural dimensions describe how the world's cultures differ in six main ways and how different cultures should strive to become the same.

<h3>What are the scale of lifestyle and its influences?</h3>

According to Hofstede, the 5 principal dimensions are identity, power, gender, uncertainty, and time. You can reflect on consideration on cultural fee dimensions on a scale or a continuum, in which one element of the fee lies on one aspect of the dimensions and the opposite intense lies at the opposite give up of the dimensions.

  1. To run VBA withinside the “Microsoft Visual Basic for Applications” window, you can surely press the “F5” key button or click on on the “Run” icon withinside the toolbar.
  2. The Visual Basic button opens the Visual Basic Editor, in which you create and edit VBA code.
  3. Another button on the Developer tab in Word and Excel is the Record Macro button, which routinely generates VBA code that may reproduce the actions that you perform withinside the application.

Read more about the Hofstede's cultural dimensions :

brainly.com/question/7158663

#SPJ1

6 0
2 years ago
Read 2 more answers
Is frequency measured in henry.
soldier1979 [14.2K]
No its measured in Hertz Hz
5 0
3 years ago
Your search google for recipe for tonight dinner is an.example of ?​
Rina8888 [55]

The example is, ethier you need cooking classes or you wish to try something new

Hope the little humor helps

3 0
3 years ago
Read 2 more answers
Children walking on the sidewalk, a person sitting in a parked car, and a parking lot with vehicles
Harlamova29_29 [7]

Answer:

Explanation:

Hello friend !!!!!!!!!!!!

The answer is <u><em>school zone</em></u>

Hope this helps

plz mark as brainliest!!!!!!!

6 0
3 years ago
If I was to sort the months of the year in ASCENDING order alphabetically, which
bogdanovich [222]
The answer is C.) April
5 0
3 years ago
Other questions:
  • A Hierarchy Custom Setting stores a specific URL for each profile in Salesforce. Which statement can a developer use to retrieve
    5·1 answer
  • The layout button is located in the ____ group on the home tab?
    14·1 answer
  • Provide an example of a time in your personal or work life when you used the household measuring system and measured out an exac
    6·1 answer
  • The two types of objects responsible for collecting data are
    14·1 answer
  • A snail goes up A feet during the day and falls B feet at night. How long does it take him to go up H feet? Given three integer
    8·1 answer
  • NEED THIS NOW PLEASE!!!! (I AM NOT JOKING I HAVE TO SUBMIT IN 5 MINUTES)
    13·2 answers
  • How to measure potential energy of a ball?
    14·1 answer
  • You dad has given you his old digital scanner for your new computer. you plug it into the usb drive on your windows 8 computer b
    8·1 answer
  • Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent singl
    12·1 answer
  • In a systems development life cycle (SDLC) model, the purpose of the _____ is to create a physical model that will satisfy all d
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!