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
How to remove special formatting from a table in word.
ch4aika [34]

Answer:

Clear Format

Explanation:

7 0
2 years ago
2. A data catalog identifies all of the following, except: a. Attribute data type b. Attribute range of values c. Attribute cons
alexandr1967 [171]

Answer:

c. Attribute constraints

Explanation:

A data catalog identifies all of the following, except: "Attribute constraints"

The above statement is TRUE because a Data Catalog, a metadata management service, operates by searching for key data, understand and manage data for usefulness.

Data Catalog checks on the BigQuery datasets, tables, and views and checks both technical and business metadata by identifying the following attributes:

1. Data type

2. Range of values

3. Value for Instructor ID

5 0
2 years ago
Which of the following can technology NOT do?
Gnesinka [82]

make our life problem free

because technology has its negative effects on humanity like Social media and screen time can be bad for mental health

And technology is leading us to sedentary lifestyles

Technology is addictive

Insomnia can be another side effect of digital devices

Instant access to information makes us less self-sufficient

Young people are losing the ability to interact face-to-face

Social media and screen time can be bad for mental health

Young people are losing the ability to interact face-to-face

Relationships can be harmed by too much tech use

4 0
3 years ago
A network packet contains two kinds of information. What are they?
Salsk061 [2.6K]

Answer:

Connectionless and connection oriented information

Explanation:

There is wireless and wired information in a network so...

6 0
3 years ago
Read 2 more answers
Assignment 1 silly sentences
ololo11 [35]

Answer:

Sally sells sea shells by the sea shore

Explanation:

3 0
3 years ago
Other questions:
  • Thanks for help evreybody
    11·2 answers
  • Your uncle spent most of his teen years in a hospital undergoing treatment for a severe physical illness. As an adult, he is rat
    10·1 answer
  • Easy STEAM question :)
    15·2 answers
  • Graphs and charts are two different elements. True or False
    15·1 answer
  • Determine the number of cache sets (S), tag bits (t), set index bits (s), and block offset bits (b) for a 40964096-byte cache us
    15·1 answer
  • How to convert mkv to avi without losing quality?
    14·1 answer
  • What are some benefits of 3-D printing?
    9·1 answer
  • Which of the following activities are performed by computer programmers? Choose all that apply.
    5·1 answer
  • I need help, whoever gets it correct will get brainliest
    7·1 answer
  • Compress<br> 00eb:0000:0000:0000:d8c1:0946:0272:879<br> IPV6 Address
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!