Ask coding questions

← Back to all posts
Help please :)

Hi everyone. I've been working on this code for like three weeks and I have no idea how to do it. So basically the code tells you how many pairs of equal numbers there are in an inputted list. The way I tried to solve it is that I compared the first number in the list to all the others, then had that first number delete itself, and then had the new first number compare to all the others. When the length of the list is at one, the code is supposed to break. But nothing I do works when working on this code. Help me please? Thanks.

ash15khng (682)

Line 9, when length of a is 1, you should get a[0].

mwilki7 (1012)

Just a few questions to help me know how the program should behave.
What is an equal pair?
Is the array layed out like:




Does a list containing [1,1,1] have 2 equal pairs?