0

I have this question that I've been trying to solve for the past hour but i've been getting it wrong, can someone help me?

Question:

Create a list of the odd numbers between 1 and n (include 1 as well as n -- if it's odd-- in the list). Associate the list with the variable odds .

My code:

odds = [1]

i = 0

for i <= n:

if i%2 != 0:

odds.append(i)

i+= 1