<In what way does your code behave incorrectly? Include ALL error messages.>
Although I got through this exercise, I have a question regarding what is termed by some users as the shortest accepted solution for this exercise. The proposed solution is:
def count(sequence, item): amount = 0 for i in sequence: if i == item: amount += 1 return amount
However, I feel that this will pose a problem: not being able to take a list as input
According to the instructions, “The item you input may be an integer, string, float, or even another list!”. However, going by this proposed code, the part about the input being able to take on a list cannot be realised; the console will just return 0 even when you print the function after it is called:
In this case, why is this solution still accepted since it does not fulfill all the requirements?