0
How to test in challenges
Hi, I see there was a new update and now the codes of challenges are tested automatically. In Python , when have my function def x(y) , what should be put in the code so it is tested by the Sololear automatically? I tested it for the first case with the 1st input and it was ok, but then when I proceeded and put the input for the 2nd case, the first one got unticked. Do you have a solution for it or should I put something additional in my code ? If I don't call a function in the code, the Sololearn algorithm doesn't call it automatically...
7 Respostas
+ 3
Your code works fine. You need to use input() like I said before, not provide your own inputs.
Change the end to
print(piglatine(input()))
0
I assume you are talking about the new Code Coach feature.
What you need to do is create a code that gets a tick for all test cases at the same time. That is when you will have correctly solved the problem.
Good luck!
0
Yes yes, I talked about Code coach, NOT CHALLENGES
0
So you should put input() in your code where you need to to take the input. The input for each test case is automatically fed in there.
To output you would use print() which I'm sure you knew anyway.
0
Hi, I really don't know how to pass it...
def piglatine(sentence):
# spep the words
# sep letters of each word
# put the first letter at the end
# add ay
# combine the elements of the array into onw
# same with words into sentence
w = []
sent = []
sentence = sentence.split(' ')
for i in range (len(sentence)):
w.append(list(sentence[i]))
first_let = w[i].pop(0)
w[i].insert(len(w[i]), first_let)
w[i].insert(len(w[i]), 'ay')
sent.append(''.join(w[i]))
final_sentence = ' '.join(sent)
return final_sentence
print(piglatine('go over there'))
print('\n'+piglatine('sally
0
The last line is piglatine ('sally knows best')
0
Thanks a lot, I didn't get it before