.
Please use markdown tags to format your code or it is very discomfortable to read: how-to-format-code-in-markdown.
Not a kata issue. Use Question label next time.
Question
returns the first n elements - signature included of the so seeded sequence.
How many elements are you returning there?
This comment is hidden because it contains spoiler information about the solution
You shouldn't change the order of the strings in the array, it's been discussed many times already (some post are hidden, but some are still visible).
@best27 that's no good either because python as a language does not promise that there only exists a single 0. For example, with jython:
0
>>> int() 0 >>> int() is 0 False
it also doesn't help for identifying 0.0 cpython 3.9:
0.0
>>> float() 0.0 >>> float() is 0.0 False
The problem is that the kata does not specify what zero is, it does not say what to look for.
It's unreadable because it's not marked up as code, and it doesn't say which language it is in, that's what's wrong with it.
If you want support on your incorrect solution, help us help you. Did you read the Troubleshooting Guide?
def move_zeros(array): #your code here bos=[] zeros=[] for i in array: if i==0: zeros.append(i) else: bos.append(i)
bos.extend(zeros) return bos
whats wrong with this code?
try i===0
Don't mutate the array you're going through, that way you skip values.
Loading collection data...
.
Please use markdown tags to format your code or it is very discomfortable to read: how-to-format-code-in-markdown.
Not a kata issue. Use
Question
label next time.How many elements are you returning there?
This comment is hidden because it contains spoiler information about the solution
You shouldn't change the order of the strings in the array, it's been discussed many times already (some post are hidden, but some are still visible).
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
@best27
that's no good either because python as a language does not promise that there only exists a single
0
.For example, with jython:
it also doesn't help for identifying
0.0
cpython 3.9:
The problem is that the kata does not specify what zero is, it does not say what to look for.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution
It's unreadable because it's not marked up as code, and it doesn't say which language it is in, that's what's wrong with it.
If you want support on your incorrect solution, help us help you. Did you read the Troubleshooting Guide?
def move_zeros(array):
#your code here
bos=[]
zeros=[]
for i in array:
if i==0:
zeros.append(i)
else:
bos.append(i)
whats wrong with this code?
try i===0
Don't mutate the array you're going through, that way you skip values.
Loading more items...