Question: Write a function called odds_up_to that returns a list with every odd number up to a given digit. For example: odds_up_to(20) # [1,3,5,7,9,11,13,15,17,19] what I

Write a function called odds_up_to that returns a list with every odd number up to a given digit.

For example:

odds_up_to(20) # [1,3,5,7,9,11,13,15,17,19]

what I have so far:

def odds_up_to(num): oddNumbers = [] # new list for i in range(start, end+1): if i%2 != 0: oddNumbers.append(i) print(i, end = " ") return oddNumbers # return the list of odd numbers result = odds_up_to() print(" Resulting list: ", result)

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!