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.
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.
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.
Why is this an issue? The "Run Suite" tab usually has different & more test cases than the "Run Examples" tab. This Kata is working fine for me. The second testcase in the "Run Suite" is different from the second example testcase. Print the input, print your output, look at the expected output etc. Refresh if it's not working.
Look at the comments down below. As I previously stated:
Look at the example test cases. Some of the tests are where the items are in lists but some of the tests are just arguments given to you. "There is only 1 argument given", 1 list counts as a single argument but multiple arguments are given, so it wants you to return the last of the multiple arguments. E.G last(1, "b", 3, "d", 5) is 5 arguments and wants you to return 5 (the last argument).
You need to unpack the arguments which will allow multiple parameters to be passed as a tuple. Also, you need to return the value instead of printing it.
This comment is hidden because it contains spoiler information about the solution
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
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 :)
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.
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.
Why is this an issue? The "Run Suite" tab usually has different & more test cases than the "Run Examples" tab. This Kata is working fine for me. The second testcase in the "Run Suite" is different from the second example testcase. Print the input, print your output, look at the expected output etc. Refresh if it's not working.
Look at the comments down below. As I previously stated:
You need to unpack the arguments which will allow multiple parameters to be passed as a tuple. Also, you need to
return
the value instead ofprinting
it.