7 kyu
Build a square
7,765 of 19,902Capocaccia
Loading description...
Fundamentals
ASCII Art
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.
in R you want to require "\n" and not "\n" as the line separator if the aim is to create shapes in formatted strings:
cat("aaa\nbbb")
aaa
bbb
cat("aaa\\nbbb")
aaa\nbbb
This comment has been hidden.
Read this: https://docs.codewars.com/training/troubleshooting#expected-the-same
Not a kata issue.
FYI, there is a solution visible in the test section. Probably should remove that!
You should probably mention the language you're talking about. If it was Rust, then it was fixed.
the tests for the attempt in c version has issues and needs to be fixed.
I've just tested my solution in C and passed, likely it is your code having unnecessary trailing
\n
characters at the end of string. Not a kata issue!you do not nul-terminate your string, it is your code that has issues ;-)
lol thanks, totally forgot terminating
This comment has been hidden.
Mark your post as having spoiler content next time please.
Oops... sorry, sure
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
Your problem is this: https://docs.codewars.com/training/troubleshooting/#expected-the-same the last bullet point.
This comment has been hidden.
Lua translation!
Approved
Scala translation
.
Please review and approve, thanks !
approved
I'm struggling with printing single backslash. In my pycharm app it works fine when I put "\" but for some reason it doesn't work in codewars. Can someone explain what is going on? Thank you
Because you're escaping the backslash like that and you should use a line-break instead:
'\n'
See the sample test:
thank you - by any chance, do you know why '\n' doesn't lead to automatic next line and instead prints out '\n' in codewars code editor? In my Pycharm when I did '\n' it automatically printed 3*3 #s without '\n' printed.
This comment has been hidden.
Please read this: https://docs.codewars.com/training/troubleshooting/#post-discourse
About your question, you're using
*
instead of+
. Also, there should be no line separator at the end.This comment has been hidden.
Your solution has a bug and it is not a kata issue.
Please run following line of code in your IDE:
print(f"My solution for n=4 is:\n{generate_shape(4)}")
and tell us the output.This comment has been hidden.
This comment has been hidden.
Do not print the result, return it instead (read this)
it says it doesnt work but on another compiler it works perfectly for all test cases.
look at it this way:
"it works perfectly for all test cases [that happen to be the paritcular ones] on another compiler"
consider which tests appear here that are missing on this other compiler
"between 1 and 50." but fixedTests() and randomTests() also include zero in c;
Fixed.
D translation
Approved!
This comment has been hidden.
Fixed
This comment has been hidden.
Is the Brainfuck interpreter working right? I´m getting "Execution Timed Out" trying the 3 test cases. I tried it on external interpreters and seems to work fine :/
This kata uses the default BF interpreter.
I cannot see your code, but it is very likely that your code was caught in an infinite loop for some specific values.
try to do it without for loop in one line..
I solved this problem in three lines without using line breaks. And that doesn't work.
Sounds like you didn't solve it then x)
You have to return the answer, don't print it.
Use IF ELSE in order to not get an issue from 0 to 50.
This comment has been hidden.
This comment has been hidden.
dont use
strcat()
on uninitialized memory (e.g. that returned bymalloc()
)compared to hackerrank codewar is harder and codewar dont start with beginner programs
I have found two different solutions for this kata, one with for loops and one involving creating a dictionary that they work perfectly on pycharm but it does not work in here. What to do about it?
C#. Sample tests are broken, they require the answer to be with "\n" symbol, but you can complete kata without this symbol by just making simple loops...
O meu acontecia exatamente a mesma coisa, só que em Python
either it was fixed at some point, or the report was wrong. C# sample tests are fine
Java. The description says "The integer will be a whole number between 1 and 50" but
fixedTests()
andrandomTests()
also include zero.Fixed.
This comment has been hidden.
why add the r''?
idk i thought coz its a new line i should prepend the string with r, would removing it work tho? edit: cheers it works as intended.
This comment has been hidden.
your string is never nul-terminated because the line-ending logic has precedence over the nul-terminating logic in your
if/else
need to update the pre-populated function name to: generate_shape. The pre-populated name that currently generates is: generateShape
+1
there is a pending issue about that.
Python: solution setup still has camelCased name.
Fixed ~~
Ruby 3.0 should be enabled, see this to learn how to do it
Fixed
Coffeescript && R
Thanks :)
it's 8 kyu i think)
Java : the instruction says : "whole number between 1 and 50", but should says 0 and 50 !
The parameter name is shadowin a built-in in Pytohn.
Python: Int should not be used as param name
Fixed
Python: Function name should be in snake_case
fixed
This comment has been hidden.
This time all tests passed but still got a seg fault?!
should_pass_all_the_tests_provided (100 of 100 Assertions)
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
This comment has been hidden.
OP solved it, closing
This comment has been hidden.
It seems a problem with your code, check the size.
just fixed it, thanks :D
This comment has been hidden.
Because you have a trailing newline that shouldn't be there.
This comment has been hidden.
After watching best solution out there I feel stupid(
This comment has been hidden.
Not a kata issue, the brackets show you where the output is different, your string starts with a new line, use Question instead of Issue label next time and mark your posts as having spoiler content when they do.
PHP translation
Brainfuck Translation kumited
Please review and approve.
Julia translation
Java Translation kumited
Please review and approve.
C++ translation has been provided. Please review and approve.
C translation kumited
please scrutinize for approval
domo!
This comment has been hidden.
This comment has been hidden.
It does not generate the correct shape. The result of your function is the same as '+'.repeat(int)
Ruby translation kumited -- please check and approve
TypeScript translation has been provided. Please review and approve.
Rust Translation for this kata.
Please review.
A value that semantically is always positive is better represented as u32 rather than i32.
Raising again. Python:
No this IS an issue, even if the code is working. And this has been acknowledge for long on CW.
No, this is not resolved.
This comment has been hidden.
You have to return a string.
Sure, my code however fails to return anything. Instead of generating a 2d array it throws an error.
"don't use numpy" ? x)
I believe it's a problem of installed versions that differ between CW and what you have at your place. Try this:
return
line)This comment has been hidden.
This comment has been hidden.
Description states: I expect a 3x3 square back just like below as a string.
This comment has been hidden.
python:
int
, butn
). Even if here that doesn't cause troubles, it's a bad practice (and may sometimes lead to really wierd/annoying behaviors).snake_cased
, notcamelCased
This is not an issue with how the code is performing.
This comment has been hidden.
You are correct. Good job spotting this! I will adjust it.
Hi, I made a C# translation for this Kata, please review and approve.
This has been reviewed and approved. Thanks for the translation!
Thanks for the kata! :) Maybe add some sample tests?
I think You should add to the description typeOf return
Thank you. This has been added.