Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a recursive function named get_multiples_of_3(numbers) that takes a list of integers as a parameter and returns a list of numbers which are divisible by

image text in transcribedimage text in transcribed

Write a recursive function named get_multiples_of_3(numbers) that takes a list of integers as a parameter and returns a list of numbers which are divisible by 3, in the same order as the given parameter. The function should return an empty list if there are no numbers which are divisible by 3 in the parameter list. Note: This function has to be recursive; you are not allowed to use loops to solve this problem! Write a recursive function named no_multiples_of_3(numbers) which takes a list of integers as a parameter and returns False if the parameter list contains any values which are divisible by 3, and returns True (i.e. all numbers are NOT divisible by 3) otherwise. Note: this function has to be recursive; you are not allowed to use loops to solve this problem! For example: Test Result print(no_multiples_of_3([2, 3, 5, 6])) False print(no_multiples_of_3([2])) True print(no_multiples_of_3([1, 3, 5, 7])) False print(no_multiples_of_3([])) True

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

Recommended Textbook for

Transact SQL Cookbook Help For Database Programmers

Authors: Ales Spetic, Jonathan Gennick

1st Edition

1565927567, 978-1565927568

More Books

Students also viewed these Databases questions