6 kyu
■□ Pattern □■ : Heart
116 of 213myjinxin2015
Loading description...
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.
This comment has been hidden.
The expected output is a single string with each row separated with line break.
You need to join your list.
This comment has been hidden.
Are you sure you're using the specific space character given in the description? because it's not the one of the space bar of your keyboard.
In the example, input 6 = 1 line full of ■, input 12 = 2 ■ lines, input 18 = 3 ■ lines. Why? Is there any special rules for those ■ lines?
You wrote the answer in the question. 6=1, 12=2, 18=3 ... Try to figure out the logic of these equations
Oh.... Ok I got it. Thanks
This comment has been hidden.
Logs in JS should be removed and placed as assertion messages
no, the assertion message is ignoring formatting. That's why the logs are there (unless I'm missing something?)
Ok, I thought putting in assertions will result in the same visual output as logs (kudos! ~~
Python:
parameter n The width of heart, an even number, n>=6
I got n=9 in the random tests and the expected heart doesn't look right.
oops sorry about that. Should be good, now...
(forgot to close)
Can
t catch the logic in one moment: how many ■■■■■■ rows should I draw? Sometimes it
s (n/2) // 2, but sometimes - notHint: n>=6 and look at examples values
All examples my code does perfectly, but test cases if very "bad". When n is odd - heart is very asimetric, and strange. Rows of ■■■■■■ in test cases is placed not by the same logic, as in examples
the odd values are a mistake I did when I translated the kata. It should be corrected now (reset the trainer/refresh the page if it is still persisting)
Oh. Finally understand the logic of flat rows. Just did it. Odd n`s are foooo
expected '◢■◣◢■◣\n■■■■■■\n◥■■■■◤\n ◥■■◤ \n ◥◤ ' to equal '◢■◣◢■◣\n■■■■■■\n◥■■■■◤\n ◥■■◤ \n ◥◤ '
@question Not sure what's up here? Thanks :)
you're not using the expected space character. Pick it from the description or the tests.
thanks
this set of characters could(/should?) be used to draw the hearts:
String.fromCharCode(8195,9698,9632,9699,9701,9700)
They lead to gaps between the rows, but at least, nothing is misaligned like it is right now....
May be somthing wrong! even space spacing are exactly same but no correct . It is Isuue?
I just tested my solution and it worked, please use
question
tag next time ~~ (Note you should refer to sample tests instead of description's examples for better clarity)Examples are not specifications.
In the pattern, the 'space' character is in fact another one :-->