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]
2 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]2 years ago
7 0

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

Olin [163]2 years ago
6 0

Answer:

sorry but there is not enough information to complete this

Explanation:

You might be interested in
Help pweaseee!! Lloyd has created a validation script for a data entry form. What property should he use to test for a selected
Talja [164]
I think it’s gonna be D. clicked
5 0
2 years ago
Write the line of code to calculate the area of a circle with radius 3 and store it in a variable called
zloy xaker [14]

Answer:

area = 2.14 * 3 ** 2

Explanation:

No clue what language you use but this should be pretty universal. To find the area of a circle you use pi(r) ^ 2 or pi times radius squared

\pi r^{2}

In python it looks like this:

>>> area = 3.14 * 3 ** 2

>>> print(area)

28.26<em> <Printed text</em>

3 0
2 years ago
Gps has fostered many benefits in our society, but have also added some risks. What is a risk of gps?
kozerog [31]

GPS is a global positioning system that tells direction and routes. Some risks that come along with GPS are inaccuracy, distraction, and lack of knowledge.

<h3>What is GPS?</h3>

GPS is a radio navigation system based on the satellite and is used to navigate the directions with the help of the signals. Though it has many benefits also has disadvantages. It sometimes does not show accurate routes and direction that is too long.

The navigation system causes distraction during driving and may cause an accident. Too much reliance on GPS causes a lack of knowledge in remembering the directions and places. It may sometimes lead to crime as the saved information and be leaked.

Therefore, GPS has advantages and disadvantages too.

Learn more about GPS here:

brainly.com/question/6905079

#SPJ4

5 0
2 years ago
41. All the following software are examples of operating systems EXCEPT
Hunter-Best [27]

Answer:

vista

Explanation:

the other three I have used before

8 0
2 years ago
If a robot is able to change its own trajectory as per the external conditions, then the robot is considered as the__.
natima [27]

If a robot is able to change its own trajectory as per the external conditions, then the robot is considered the intelligent option (A) is correct.

<h3>What is AI?</h3>

Unlike the natural intelligence exhibited by animals, including humans, artificial intelligence is a form of intelligence demonstrated by robots.

The question is incomplete.

The complete question is:

If a robot can alter its own trajectory in response to external conditions, it is considered to be:

A. intelligent

B. mobile

C. open loop

D. non-servo

E. None of the above

Robots are regarded as intelligent if they can alter their own course in response to environmental factors. These kinds of agents fall into the AI agent or Rational Agent group.

Thus, if a robot is able to change its own trajectory as per the external conditions, then the robot is considered the intelligent option (A) is correct.

Learn more about AI here:

brainly.com/question/27839745

#SPJ4

5 0
2 years ago
Other questions:
  • What systemctl command configures a unit to start the next time the computer boots?
    10·1 answer
  • You need to delegate AD RMS responsibilities to a junior administrator. You don't want to give the administrator more permission
    14·1 answer
  • On laptops, wireless cards tend to be attached to which panel?
    8·1 answer
  • The default paper size is _____. <br> a. letter <br> b. legal <br> c. executive <br> d. statement
    7·1 answer
  • Does anyone know the answers?
    8·1 answer
  • A prefab allows you to reuse game objects over and over, while their component data remains intact. (1 point)
    14·1 answer
  • Discuss five processes for analyzing a qualitative study
    11·2 answers
  • Charles was supposed to present his PowerPoint slides to his classmates in a classroom, but now he has to present in the auditor
    12·2 answers
  • Cultural differences may make it difficult for team members to _____. Select 4 options.
    14·1 answer
  • What are the local, state, and national opportunities that may be available to those who participate in CTSOs?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!