Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

program is python pycharm Part V: Sum Squares and Cubes (20 points) Write a function sum.them () that sums a set of integers, each of

image text in transcribed program is python pycharm
Part V: Sum Squares and Cubes (20 points) 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 na to the total if the number's index in nums is even; otherwise, the index is odd, so add n to the total. The function takes one argument: nums: a list of integers to process according to the above description As an example, for the argument (5, 2, 3], the function would return 42 because 52 + 23 + 32 = 42. In the case that the input list is empty, the function returns 0. Examples: Function Argument Return Value [-1, -8, -41 [8, 6, 1, 3, 2) [0, 1, 7, -3) [5] [5, 2, 3] -495 312 23 25 42

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions