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
What font family is Times New Roman an what font family is Arial?
Alexxandr [17]

Answer:

Some Font Examples

Generic Font Family                 Examples of Font Names

Serif                    Times New Roman Georgia Garamond

Sans-serif                          Arial Verdana Helvetica

Monospace                     Courier New Lucida Console Monaco

Cursive                        Brush Script MT Lucida Handwriting

Explanation:

hope it help

4 0
3 years ago
Read 2 more answers
Three negative impact of littering<br>​
andrew11 [14]

Answer:

planet destroyed

loss of animals

resources wasted

Explanation:

8 0
3 years ago
KeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKeyonnnKe
const2013 [10]

Answer:

Hey

Explanation:

Thank.you for your comment!

7 0
3 years ago
Read 2 more answers
Employers hiring for entry-level positions in Hospitality and Tourism expect workers to learn the required skills after they sta
vovikov84 [41]
<h2>have basic skills required to do the job</h2>

Explanation:

expect workers to learn the required skills after they start:  

The must have basic skills then only they can employ to upgrade further skill

have the required skills before they start:  

We cannot expect all the skills. Skill will develop through experience too.

acquire the necessary skills through education: only if they have necessary education for performing the job, then only the company will short-list. So, this is an entry criterion.

have basic skills required to do the job: This is the right answer. This aspect is enough for an entry-level position.

8 0
3 years ago
Read 2 more answers
A team member who does not feel comfortable disagreeing with someones opinion in front of the team would most likely come from a
Sedbober [7]

Answer:

discussions and decisions made about public policy

Explanation:

7 0
2 years ago
Other questions:
  • When making college visits, you may be able to....
    9·2 answers
  • An existing document that you use as a starting point for a new document; it opens a copy of itself, unnamed, and then you use t
    15·1 answer
  • Which would be a responsible use of technology used by victims of cyberbullying? finding ways to strike back at bullies online.
    15·1 answer
  • Research and discuss the LAMP (Linux, Apache, MySQL, and PHP) architecture. What is the role of each layer of this software stac
    14·1 answer
  • Peter wants to protect a confidential document by using a password. He wants to use an asterisk and an ampersand symbol in his p
    10·1 answer
  • When is 1600 plus 25 and 1700 minus 35 the same thing?​
    10·1 answer
  • What’s GIGO<br> Please write it in full form
    15·1 answer
  • The average American has 10 devices, ask for users average number of devices. Any number between 7 and 12 will print “you have a
    13·1 answer
  • Which structural semantic will this HTML code snippet form?
    13·1 answer
  • How could this code be simplified?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!