Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

image text in transcribed

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

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_2

Step: 3

blur-text-image_step3

Ace Your Homework with AI

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

Get Started

Recommended Textbook for

SQL Instant Reference

Authors: Gruber, Martin Gruber

2nd Edition

ISBN: 0782125395, 9780782125399

More Books

Students also viewed these Databases questions

Question

What is the purpose of a code of conduct ?

Answered: 1 week ago

Question

What are Decision Trees?

Answered: 1 week ago

Question

What is meant by the Term Glass Ceiling?

Answered: 1 week ago