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
Elanso [62]
3 years ago
7

Write a function called add_tuples that takes three tuples, each with two values, and returns a single tuple with two values con

taining the sum of the values in the tuples. Test your function with the following calls:
print(add_tuples( (1,4), (8,3), (14,0) ))
print(add_tuples( (3,2), (11,1), (-2,6) ))
Note that these two lines of code should be at the bottom of your program. This should output

(23, 7)
(12, 9)

this is my output but I keep getting errors;
def add_tuples(tup):
add1= tup[0][0]+ tup[1][0] +tup[2][0]
add2= tup[0][1]+ tup[1][1] + tup[2][1]
return add1, add2
print(add_tuples( (1,4), (8,3), (14,0) ))
print(add_tuples( (3,2), (11,1), (-2,6) ))
Computers and Technology
1 answer:
Leni [432]3 years ago
4 0

In Python, tuples are indeed a data structure that also stores an ordered sequence of unchanging values, and following are the Python program to the given question:

Program Explanation:

  • Defining a method "add_tuples" that takes three variables "firstTuple, secondTuple, thirdTuple" into the parameter.
  • After accepting the parameter value a return keyword is used that adds a <em><u>single tuple with two values</u></em> and returns its value into the form of (x,y).
  • Outside the method, two print method is declared that calls the above method by passing value into its parameters.

Program:

def add_tuples(firstTuple, secondTuple, thirdTuple):#defining a method add_tuples that takes three variable in parameters

   return firstTuple[0]+secondTuple[0]+thirdTuple[0],firstTuple[1]+secondTuple[1]+thirdTuple[1] #using return keyword to add value

print(add_tuples((1,4), (8,3), (14,0)))#defining print method that calls add_tuples method takes value in parameters

print(add_tuples((3,2), (11,1), (-2,6)))#defining print method that calls add_tuples method takes value in parameters    

Output:

Please find the attached file.  

Learn more:

brainly.com/question/17079721

You might be interested in
We all interact with various information systems every day: at the grocery store, at work, at school, even in our cars (at least
Serhud [2]

Explanation:

An information system can be defined as an automated system or not, which is used for the purpose of collecting data and transforming it into relevant information for a given purpose.

Currently, information systems are increasingly used in the organizational environment, for example, as management information systems and decision support systems, which are automated computer systems that provide greater support to a manager's work, due to the amount of data that store and process relevant information to assist in the speed of the decision-making process, since information systems are able to capture a volume of data and analyze it, create standards, find flaws and transmit essential information that makes the manager's work more facilitated and improved.

8 0
3 years ago
Corinne is taking a chemistry class in college. A lab assignment asks students to track the melting point of ten different subst
Dmitrij [34]

Answer:

a spreadsheet

Explanation:

The data is of statistical type and is experimentally based. And hence, the spreadsheet is the best kind of software that can be used to register the record. And we can save 10 such experient results with the same format of tables on 10 different worksheets, and if we want we can adjust the readings of the 10 similar experiments at one time. And hence, we can quite effectively record as well as analyze this data on the spreadsheet. Hence, the spreadsheet is the correct option.

4 0
3 years ago
IF ANSWER I WILL BE REALLY HAPPY
butalik [34]

Answer:

C.

Explanation:

7 0
3 years ago
Read 2 more answers
What is the full word of"VPN"?​
pantera1 [17]

Answer:

Virtual Private Network.

Explanation:

A VPN helps protect your data when accessing the internet. It usually scrambles your IP location and encrypts your data.

5 0
3 years ago
Read 2 more answers
A device receives a data link frame with data and processes and removes the Ethernet information. What information would be the
il63 [147K]

The information that would be the next to be processed by the receiving device is: IP at the internet layer.

<h3>Internet protocol (IP)</h3>

Internet protocol is a network protocol that help to transmit data to user device across the internet or network which inturn make it possible for user device to connect and communicate over the network.

Internet protocol at the internet layer is a TCP/IP software protocol which sole purpose is to transfer data packets across the internet after receiving and processing the data.

Inconclusion the information that would be the next to be processed by the receiving device is: IP at the internet layer.

Learn more about internet protocol here:brainly.com/question/17820678

7 0
2 years ago
Other questions:
  • Suggest how the following requirements might be rewritten in a quantitative way. You may use any metrics you like to express the
    7·1 answer
  • Nathan notices his computer System is slowing down when he tries to copy documents to it he also gets a prompt I warned him that
    7·1 answer
  • Which business application uses location information to provide a service and is designed to give mobile users instant access to
    5·1 answer
  • Is it okay to leave your car running while parked?
    15·1 answer
  • (EASY 15 POINTS) What are two indications in a browser that a secure connection is being used?
    6·1 answer
  • One of your primary business objectives is being able to trust the data stored in your application. You want to log all changes
    10·1 answer
  • The small gear that is driven by the motor shaft of a rotisserie is called a?
    9·1 answer
  • Wrtie a program in which we will pass a value N. N can be positive or negative. If N is positive then output all values from N d
    8·1 answer
  • Which key doesn't relate to keyboard
    6·2 answers
  • Python uses standard order of operations to evaluate equations. True False
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!