Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
OP solved it, closing
This is a textbook solution. However, remember that nothing past Return will execute so you might want to move up that print statement.
This error means that you're trying to loop through something you can't loop through, like
for i in 8:
doSomething()
This doesn't makes sense, so Python gives you a TypeError. In this case, the simple problem is that the problem wants you to find how many
x
s are inxs
, not the other way around! Switch your line to:def number_of_occurrences(xs, x):
and you should be good.
This comment is hidden because it contains spoiler information about the solution