How can I apply this python code wherein I have an input n. Then create a list from 2, n and remove the multiples of n. Example: Input: 10 Output: 2, 3, 4, 5, 6, 7, 8, 9 def createList(n): #Base Case/s #TODO: Add conditions here for your base case/s #if : #return #Recursive Case/s #TODO: Add conditions here for your recursive case/s #else: #return #remove the line after this once you've completed all the TODO for this function return [] def removeMultiples(x, arr): #Base Case/s #TODO: Add conditions here for your base case/s #if : #return #Recursive Case/s #TODO: Add conditions here for your recursive case/s #else: #return #remove the line after this once you've completed all the TODO for this function return []
How can I apply this python code wherein I have an input n. Then create a list from 2, n and remove the multiples of n.
Example:
Input: 10
Output: 2, 3, 4, 5, 6, 7, 8, 9
def createList(n):
#Base Case/s
#TODO: Add conditions here for your base case/s
#if <condition> :
#return <value>
#Recursive Case/s
#TODO: Add conditions here for your recursive case/s
#else:
#return <operation and recursive call>
#remove the line after this once you've completed all the TODO for this function
return []
def removeMultiples(x, arr):
#Base Case/s
#TODO: Add conditions here for your base case/s
#if <condition> :
#return <value>
#Recursive Case/s
#TODO: Add conditions here for your recursive case/s
#else:
#return <operation and recursive call>
#remove the line after this once you've completed all the TODO for this function
return []
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images