Recently, I've been flagging quite a few questions as typos (Not reproducible or was caused by a typo). I would like to hear what the consensus is. Some examples are (albeit simplified and paraphrased):
One user asked why this raises an exception.
a = [1, 2, 3]
num = input()
a.append(int(num))
print(a.index(num))
Which appends an integer but searches for a string.
Another user asked why they got different output for these two "seemingly equivalent" pieces of code.
i = 0
while i < 10:
print(a[i] - a[i+1])
i = 0
j = i + 1
while i < 10:
print(a[i] - a[j])
In which they forgot that j
wasn't updated in the loop.
To me, it seems like they forgot a function call or single line of code, and that the user would be able to solve the problem and understand the issue with some simple debugging. I'd categorize these as typos as the answers are just "You forgot X".
If not, how should I flag them considering these questions are also very specific to the user and not useful for other people?
int
when appending it to the list. But yes, in other cases where it's clear that that's the issue, I'd mark it as a duplicate.j = i + 1
does makej
an expression that is updated alongsidei
would make for a generally useful question that just happens to have an example – and admittedly countless duplicates.num
is a string. "Forgot" sounds very much like "typo" to me.int(num)
, some beginning python programmers would expect it to changenum
to an integer. In this case, rather than simply a typo, I think that they have some basic misunderstanding of the semantics of function calls. I agree that closing questions like that makes sense, but calling them typos is a bit of a stretch.