Question: Please write this in Racket programming language without using for-loops 7. Write a function called my-sum that accepts a list. The function should return a

 Please write this in Racket programming language without using for-loops 7.

Please write this in Racket programming language without using for-loops

7. Write a function called my-sum that accepts a list. The function should return a sum calculation based on the following rules: 1) if the number in the list is a zero, then add one to the sum, 2) if the number in the list is an even number, then add the double of that number to the sum, and 3) if the number in the list is an odd number, then add the square of that number to the sum. > (my-sum '(1 2 3 4 5)) 47 > (my-sum '(0 0 0)) 3 > (my-sum '(2 4 6 8)) 40 > (my-sum '(0 5 0 4 3 0 2 0 1)) 51

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!