šŸPattern coding challenge with one twistšŸ

Keerti Prajapati
Analytics Vidhya
Published in
2 min readJul 31, 2020

--

Iā€™ve been solving some coding challenges since last few days to improve my coding skill. Iā€™ve came across with one question that seems very simple at first, but before I go ahead read the challenge below

It is very simple challange if you use little logic. I wrote code and got same output but test cases got failed. See the code and output below:

Did you find any difference between my output and expected output?

Output is same but why test cases got failed?

Letā€™s see the difference

Ohā€¦did you see the difference? One extra spaces causes the test cases to fail.

Now the question is which line of code causes extra spaces. Answer is definitely print statement might have cause extra space. ā€œ end = ā€˜ ā€˜ ā€ parameter of print causes that extra space.

--

--