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.
Both of these points are issues, not suggestions.
Not a suggestion.
Not an issue
Not kata issue.
Hint:
/
is different between Python 2 and 3 ;-)Description updated.
It is similarly not made clear that there will be non-alpha entitities (punctuation). That significantly alters things so that some approaches make much less sense.
This comment is hidden because it contains spoiler information about the solution
Thanks a lot that really helped...after some googling that is.
I recommend checking this out (that helped me) - http://effbot.org/zone/default-values.htm#what-to-do-instead
Yeah, the Python translation may or may not pass an argument through the function - you need a default argument in the function to deal with this.
yeah, i did the same, but still got 'missing 1 positional argument', not sure if it's a bug.
Happy to help :)
Thank you for the quick reply. I am just really surprised that the suggested solution from stackoverflow (which was endorsed by 478 people) did not work.
Anyhow, thanks a lot again! I really appreciate it.
In Python2 integer division always returns an integer whilst float divison will always return a float. 25/25 returns an integer, 25/25.0 returns a float. Therefore isinstance(25/25.0, int) will always return false (since it returns a float), and so it is better to use .is_integer().
This is a problem in Python2, however these issues have been fixed in Python3, and Python is now consistent in the way it handles float and integer values.
Thank you very much. You are really a savior! Could I please ask you one additional question? Since you are clearly an expert.
print(isinstance(25/25.0, int))
or
print(isinstance((25/25.0), (int, long)))
Why do both of these return False? I found this method http://stackoverflow.com/questions/3501382/checking-whether-a-variable-is-an-integer-or-not but it simply does not seem to work for me.
I am going to use ().is_integer() as that seems to work but it is still bugging me why the method above does not work.
In Python 2, divison (/) is actually integer divison/floored divison, where it floors to the nearest number see here and here. The result of the division will always be an integer and therefore isinstance will always return true.
You need to cast one of the values to a float.
Loading more items...