"Even Odds" with python problem

Revision en1, by mogermany, 2022-06-30 22:20:54

Hi everbody I have a problem with a codefoeces task called "Even Odds" 318A - Even Odds with python My code do not work with the test number 8

that is my code

def create(n,k):

numbers=[]

i = 1

o = 1

while i <= n:

if i%2 != 0:

numbers.append(i)

i+=1

while o <= n:

if o%2 == 0:

numbers.append(o)

o+=1

return numbers[k]

####

n, k = map(int, input().split())

print(create(n, k-1))

Can u help me please ?

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en1 English mogermany 2022-06-30 22:20:54 611 Initial revision (published)