8 kyu
Super Duper Easy
17,378 of 41,925Aweson1
Loading description...
Fundamentals
View
This comment has been reported as {{ abuseKindText }}.
Show
This comment has been hidden. You can view it now .
This comment can not be viewed.
- |
- Reply
- Edit
- View Solution
- Expand 1 Reply Expand {{ comments?.length }} replies
- Collapse
- Spoiler
- Remove
- Remove comment & replies
- Report
{{ fetchSolutionsError }}
-
-
Your rendered github-flavored markdown will appear here.
-
Label this discussion...
-
No Label
Keep the comment unlabeled if none of the below applies.
-
Issue
Use the issue label when reporting problems with the kata.
Be sure to explain the problem clearly and include the steps to reproduce. -
Suggestion
Use the suggestion label if you have feedback on how this kata can be improved.
-
Question
Use the question label if you have questions and/or need help solving the kata.
Don't forget to mention the language you're using, and mark as having spoiler if you include your solution.
-
No Label
- Cancel
Commenting is not allowed on this discussion
You cannot view this solution
There is no solution to show
Please sign in or sign up to leave a comment.
Why is 1.2 = 66? This Kata is broken. If we round down to 1, then it should be 56.
what rounding? 1.2 x 50 is exactly 60, add 6 and you get 66...
Strongly typed languages below should be deleted. Parsing a string and type checking are 2 different tasks and both should not co-exist amongst different languages of the same shared description ...
C#
Scala
These languages should be updated: Use
object
(ordynamic
) in C# and a similar type in Scala.This is one of those kata's where raising an exception would have been the better option.
This comment has been hidden.
This comment has been hidden.
cool kata
who da fq made this test
Import issue not allowing script to properly execute
Care to explain more..? Which language? What "import issue"? What script?
See https://docs.codewars.com/getting-started/solving-kata
No reply in 4 days... Closing as invalid issue.
my favorite kata
I feel like test cases should also be testing strings like "5", there's some solutions that wouldn't pass if that was the case.
in Python (at least) random tests do not produce any strings.
There is an error wit the test where a = 3 it is expecting 66 and actual instead of 156
not the case, it seems you are misreading the feedback (the log appears above the tests result). regardless, your code has a bug.
This comment has been hidden.
You should probably test your function and observe how it behaves. There should be example tests that show you some inputs and corresponding expected outputs that you can use for that purpose, and if those are not enough then you are still free to obseserve those things in the full tests by printing.
I marked your comment as spoiler.
Why is ther no paameters for floats?
I'm getting 'Error' returned when the number 3 is being passed. I've checked that it is actually an integer and not a string. Also it says it should equal 66 but (3*50) + 6 is 156. Not sure if it's a bug. Also I'm doing this kata in Python
you must not forget the float type
On the python attempty for this project, I keep on getting an error that says it should be 66 and not 56, I am not sure where I am going through as I am only getting this one error and all the others seem to be a pass.
Your code has a bug, not a kata issue. Print the input to help you debug your code.
Maybe you are converting the input to an integer, you should try using float to check if the input is a number, remember that the input can also be a float, if you use int then it would round the number and your response would not match the given in the kata, and then when you return your response, convert it to an int before sending it.
Lua translation available
Approved by someone
none should equal "Error" rest of tests pass but i am already checking if a is None
print
returnsNone
. Change your code to return the string"Error"
instead of printing. It's in the Troubleshooting too: https://docs.codewars.com/training/troubleshooting/#expected-the-sameThanks I had worked it out in the end. But how does the user access the troubleshooting for the challenges?
The troubleshooting is general, and you can access it from the left hand side bar (at least in desktop mode) Under About -> Docs.
Actual and expected are swapped in PHP
Fixed, updated to PHP 8 and added sample and better random tests.
Would you please mind your language and find some other way to express your negative emotions?
The prolog solution only works if "Error" is returned for all non-numbers, as observed by Toaster192 and razetime. In that respect, the problem description is misleading.
Fixed. See the post below by razetime for an explanation.
Should the description be everything other than integer should display "Error" as output or are we ignoring the corner cases here?
Please improve the tests of this kata.
You need to be more specific.
I can only agree. The values 'Error', 6, and 56 were not accepted for a= ''hello", 0 and 1
@Nils888Bohr you're printing instead of returning.
Scala translation
The basic attemp test with a = 3 in python is wrong. It expects 66 as a result, instead of 156. It also shows my returned value as 56 for some reason. I believe this is a bug/issue because my code passed a random test case with a = 3.
You're reading the logs wrong, the previous test expects 66, not a kata issue.
Read this: https://docs.codewars.com/training/troubleshooting#print-input
So the log is below its respective test, right? In my case the failed test says: 56 should equal 66
And the log right below it is: input = 3. Input is "a" method parameter.
I still don't see how I'm reading this wrong unfortunately, can you give me some help?
no, it's above the related assertion
I see, I assumed it was below, just like the passed tests. Thanks for the help.
I have the same issue as Toaster192. The kata random tests in Prolog must be fixed to check only string errors.
Thanks for raising the issue, but you should also reply to the post where I published the translation (or message me on Discord), otherwise I don't get notified. Which I didn't, for 2 years... Random tests generated a bunch of atoms, not strings, but I just added a fix for that.
Apparently in the Prolog version anything that's not a number should return "Error", not just strings.
Is this kata all the way plus six? I have no idea what is right. Can someone help me with that(Python)?
You could ask for help on the Code Wars discord chanel. Or you could msg me on discord and I will help you Yanni#6959
This comment has been hidden.
looks like u solved it ~~
The tag 'BUGS' is misleading and should be replaced. It's a simple implementation excercice. Instead, the tags 'Fundamentals', 'Data Types', 'Strings' and 'Numbers' seem to be more fitting :)
fixed
Kata made my day!!
C++ translation kumited
This article was tough for a beginner, but it had the concepts that helped me figure this one out. I didn't find it needed to use all of the non-beginner kinds of tools the author uses. https://medium.com/better-programming/how-you-make-sure-input-is-the-type-you-want-it-to-be-in-python-521f3565a66d
It gives a Name Error when I test it but goes through perfectly for attempt
This comment has been hidden.
Not a kata issue.
This is the test that's expecting error, but you're returning 6.
This comment has been hidden.
I just told you your solution fails on empty string, not 0. Weird behaviour for isNaN, but hey that's JS :P
Also, you got to mark your posts with spoiler flag when posting code snippets.
This comment has been hidden.
You're returning
"Error"
if the value is not an int.This comment has been hidden.
C translation kumited. Please scrootinize and aproov!
thanks for the points lol
Any help with this "5th fianl case seems broken, Error should equal 66"
print your input, check its type, print your output, compare to test results
This comment has been hidden.
I like how it disguises itself as a simple problem.
Edit: I found it when I filtered for the hardest 8kyu kata.
def problem(a): if isinstance(a,int): return (a * 50) + 6 else: return "Error"
This is my code (python) I get everything right only one error: "Error" should equal 66 But if my math is good enough I am prett damn sure that 66 would only be posible if a is a float (not a whole number) where do I have an error?
A float is not a string.
Thanks a lot! I really do not know why i didn´t think of that. Keep up the good work!
I think this Kata is terrible because of different input types.
I think that's the point lol
Can someone explain to me why it fails one of the tests when I tried:
return a * 50 + 6 if type(a) == int else 'Error'
but it doesn't fail when I code:
return 'Error' if type(a) == str else a * 50 + 6
What it is that trips up this difference?
This comment has been hidden.
This comment has been hidden.
the PHP version is lacking its random tests.
Has them now. That language looks funky.
Less vague Kata title would be better - current one give no indication what this is about.
Give better description for the argument, what is it, what can I expect. At least you should put that it is a string.
It's pretty clear from this. It passes only numbers and string, which is also shown in test cases.
Thanks for answer. My solution was for C# version where function accepts ONLY string for argument.
it talks only about string types and int types but it should have a clear exception for all types.
This is a Suggestion at best. Other data types are not tested in the test cases so you do not need to worry about dealing with them.
Description is unclear (type of input number).
May you please clarify the language in which you are encountering this Issue?
surely it's
C#
-related. Note added in the description.Nice 'Hello world' kata.
The last case works fine and this kata is not broken, despite what you may read in the comments. The kata only says to return 'Error' for string.
In C#, the input is always a string. Which means that there will be type casting. I think you should clarify that.
done
Upvoted, ranked, translated into both Python and Ruby if you wish to approve them.
If I might suggest, a more fitting title and specifying in the description the kind of input the user is going to get would help. A lot.
This comment has been hidden.
Apparently, undefined behavior, that is, whatever you like.
The test cases do not provide any input into your function which is neither a number nor a string so you do not have to worry about dealing with such cases.
In the description it is best to add what type of arguments you are expecting in the string (i.e. double values)
Not sure what you mean but pretty sure this is a Suggestion at best. The description is sufficiently clear as to what input is expected and what behaviour the user solution should exhibit in each case.
last case returns 56 not 66. cannot finish.
I was having that same issue! Frustrating
Final case broken: a * 50 + 6 does NOT equal 66, despite what you claim
a = 1.2 ? :)
I have the same issue and I wasn't able to find the problem, any ideas?
The kata would benefit from a better description / title Super Duper Easy is not informative.
Please re-raise this as a Suggestion instead of an Issue; a non-informative title does not affect the completability or quality of the Kata.
5th fianl case seems broken, Error should equal 66
This comment has been hidden.
Thank you for the feedback and the expalanation I'll be sure to add that to the tests.
Don't use an exclamation mark after a number. I've misread "6!" as the factorial of six.
+1
I changed the program so now it says 6.
Three test cases is not enough. Provide more, at least 10, with variations; preferably random tests too.
The program now has 11 different test cases.