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
lawyer [7]
3 years ago
12

Write a function sum them() that sums a set of integers, each of which is the square or cube of a provided integer. Specifically

, given an integer n from a list of values, add n2 to the total if the number’s index in nums is even; otherwise, the index is odd, so add n3 to the total.

Computers and Technology
1 answer:
dusya [7]3 years ago
3 0

Answer:

# sum_them function is defined

def sum_them():

   # A sample of a given list is used

   given_list = [1, 2, 3, 4, 5, 6, 6, 9, 10]

   # The total sum of the element is initialized to 0

   total = 0

   # for-loop to goes through the list

   for element in given_list:

       # if the index of element is even

       # element to power 2 is added to total

       if(given_list.index(element) % 2 == 0):

           total += (element ** 2)

       else:

       # else if index of element is odd

       # element to power 3 is added to total

           total += (element ** 3)

   # The total sum of the element is displayed

   print("The total is: ", total)        

           

# The function is called to display the sum

sum_them()            

Explanation:

The function is written in Python and it is well commented.

Image of sample list used is attached.

You might be interested in
In order to control access to a company's intranet and other internal networks, all communications pass through a _____ server.
katen-ka-za [31]

Answer:

Web server

Explanation:

4 0
3 years ago
PLZ HELP What will be the output? class num: def init (self.a): self. number = a mul* __(self. b) return self. number + b. numbe
Vilka [71]

Answer:

15

Explanation:

got it right on edge

3 0
3 years ago
What information is displayed in the message header of a received message? Check all that apply.
Aleks04 [339]

Answer:

the subject of the message

the sender's name

the recipient's name

the date and time when the message was received

Explanation:

Various information is displayed in the header of the message of a received message. And they are the subject of the message, which briefs what is there inside the message. And it mentions the sender's name as well as the recipient's name, and finally, the date and the time as well are stated that explains exactly when the message was being received. And all this information is shown in the header of the message.

3 0
4 years ago
There are 4 classrooms for fifth grade and 4 classrooms for sixth grade at a school. Each classroom has 20 students. A teacher i
olga_2 [115]

Answer:

what do you want

Explanation:

there are 160 people in all if thatś what you want

5 0
3 years ago
Read 2 more answers
Which magazine can help public determine best technology to buy
Dennis_Churaev [7]
Consumer report would help determine the best technology to buy.
4 0
3 years ago
Other questions:
  • What is a lease? AA contract outlining the terms of a mortgage. BA contract outlining the terms under which a landlord agrees to
    15·1 answer
  • *blank* is the unauthorized copying and selling or distributing of licensed video games.
    10·1 answer
  • What is computer piracy? Describe some examples.
    8·2 answers
  • What are paragraphs separated by
    9·1 answer
  • A PC is not able to connect to a wired network. Pinging the loopback address is successful, but the gateway cannot be reached. O
    12·1 answer
  • Why is network security important? Check all of the boxes that apply. A. Network security allows organizations to continue to fu
    8·1 answer
  • Authentication is a mechanism whereby unverified entities or supplicants who seek access to a resource provide a label by which
    12·1 answer
  • The online underground is used _____. Select 3 options. by law-abiding citizens only on Black Friday for networking by criminal
    11·1 answer
  • PLEASE HELP! Please dont answer if your going to guess
    14·2 answers
  • What does it mean when it says this person is unavailable on messenger.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!