educative.io

Educative

My code worked but the test said I was wrong

def rep_cat(x, y):
# Write your code here
x = str(x)*10
y = str(y)*5
return print(x+y)

rep_cat(3,4)
rep_cat(1,0)

It brought out the right output but it was graded as a fail, why?


Type your question above this line.

Course: https://www.educative.io/collection/10370001/5473789393502208
Lesson: https://www.educative.io/collection/page/10370001/5473789393502208/6717217993392128
indent preformatted text by 4 spaces

Hey @Kofogt!
Your solution just needs a few indentations and a little change in the return statement. Here is the correct version of your code.

def rep_cat(x, y):

    x = str(x)*10
    y = str(y)*5
    return (x+y)

rep_cat(3,4)
rep_cat(1,0)

We appreciate learners who deep dive and explore new solutions to problems. We hope educative has inspired you to further your learningšŸ˜Š

Hi Aiman,

I had it indented in the code but when I copied it, it lost indentation. I am wondering why the code was marked as wrong under the exercise when it works. Why do I have to write it exactly like the example?

Thanks,
Kofo

Hey @Kofogt!
The test case is designed to check the return value of the function. It is failing your test because you are returning null from the function and just printing the output. Thatā€™s why the Actual Output column is empty.
Thank you for asking the question :slight_smile: