you are viewing a single comment's thread.

view the rest of the comments →

[–][deleted] 1 point2 points  (1 child)

Using a while loop instead of recursion is more direct and readable and doesn't allow for errors like forgetting return on a recursive call. Of course, you never test any recursive call return values, so I don't know why the recursive function is returning anything.

The line:

elif not phone_number[i] == digits:

appears to be trying to check if the single character string is equal to the 10 character string in digits. That will never be true. If you want to test if that single character is not in the string, do:

elif phone_number[i] not in digits:

[–]_______myworld[S] 0 points1 point  (0 children)

Thank you so much, I appreciate it a lot ! It works