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.
Thanks!
i is used a lot, as a shorthand for index, that is the position of an item in a sequence.
here we are iterating on the items of the friend list directly, not on their index.
So there is no reason to name the variable i, f as a shorthand for friend is better.
Clean code. Loop variable names doesn't always have to be "i".
'f' from 'friend' probably.
The
if odd
part is an example of Truthy values in Python - you can learn more here:https://www.freecodecamp.org/news/truthy-and-falsy-values-in-python/
(Not an endorsement of freecodecamp, just the first google search result that looked OK).
In this case, it is a shorter version of
if odd == 1
, which in turn is determined by the remainder calculation in the step above.You can also experiment with this in your IDE: for example try:
You should find that only the first statement will print.
This comment is hidden because it contains spoiler information about the solution
Can I ask why did you choose "f" as your variable over "i"? is there a word associated with it?
^ one liner [562]
the same here. I had this problem once with another kata and turned out I was printing the value instead of returing it. this time I can't find any mistake but I gueess the problem is on our end again ;)
This comment is hidden because it contains spoiler information about the solution
I'm getting the same output as it wants from me but it throws an error after testing. I double checked and changed the brackets, dashline and even added the quotation marks but it still says "None should equal '(123) 456-7890' "
*Update: ah I'm sorry. It's sattled, I noticed I was printing the resault and not retruning it 🤦🏻♂️🤦🏻♂️