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
What is virtualization?
anzhelika [568]

Answer:

Virtualization refers to the act of creating a virtual version of something, including virtual computer hardware platforms, storage devices, and computer network resources.

Explanation:

I hope this was what you were looking for

3 0
3 years ago
Read 2 more answers
put together a shopping list of items that a first responder should always have at immediate disposal in a field kit. Using curr
Viefleur [7K]

Answer:

dont forget the trail mix

Explanation:

honestly you can go bougie or you can go doomsday prepper macgyver style.

Ill give you what I would bring as a field medic but you didnt really specify the situation so hopefully this can spark some ideas for your project. You can find everything here on amazon so ill let you go ahead and do that..

<u>PPE</u>

gloves

masks

eye protection

reflective wear

weapon system

<u>Medical</u>

Tourniquets

Pressure Dressings

NSAIDs

Aspirin

Safety pins

IO drill

IV supplies

Space blanket

Thermometer

Chapstick

Silktape

Bacitracin

<u>EDC</u>

Flashlight

Pens/markers

write in the rain

Firestarter

Duct tape

knives/trauma shears

saw

Watch

550cord

gummy worms & water

Radio/ Garmin inreach

Triage tags

3 0
3 years ago
How many programs can you run in Windows simultaneously
jenyasd209 [6]

Answer:

We can run multiple programs on windows simultaneously. There is no specific limit to run the programs.

Explanation:

We can run multiple application at the same time without having any limit.

<u>Microprocessor</u>

Microprocessor is the essential part of the computer. It is used to perform arithmetic and logic operations. The microprocessors are multitasking, its means that they can perform multiple tasks at the same time. It gives breaks all tasks into small portions and gives equal time to all process portions equally.

<u>Windows</u>

There is scheduler in windows that schedule all tasks for processing on priority basis. This will help computer to perform multiple task at the same time.

As computers have microprocessors that are used to process multiple application at the same time.

7 0
4 years ago
The non-conditional boolean logical and operator is written as ____.
bixtya [17]
False because whhy would it be true. words of logic

3 0
3 years ago
Why did Constantine establish a new capital of the Roman Empire in Byzantium?
mestny [16]

Answer:

Explanation:

For to stablish with more power his new empire based on christianity.

5 0
3 years ago
Read 2 more answers
Other questions:
  • If you only use part of a quotation, it is not necessary to include a citation
    6·1 answer
  • A server provides the services to take you to the correct website domain when you type cengage.com in your web browser. If this
    7·1 answer
  • Develop an sec (single error correction) code for a 16-bit data word. generate the code for the data word 0101000000111001. show
    6·2 answers
  • What is the difference between a key escrow and a recovery agent? (Choose all that apply.)
    12·1 answer
  • The Color Picker tool enables you to work with color selections. Which of the following color models are used by the Color Picke
    11·1 answer
  • Clicking a _____ name opens a drop-down list of commands and options. Select one: a. menu b. status bar c. ribbon d. toolbar
    15·1 answer
  • Create a basic program that accomplishes the following requirements: Allows the user to input 2 number , a starting number x and
    12·1 answer
  • How can blockchain be used to support sustainable business practices?
    8·1 answer
  • What is the accurate description
    12·1 answer
  • What should the Dhruv consider when connecting to the Internet in a public place? Select all that apply.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!