0

SoloLearn's python code interpreter is finicky

Hello, I'm taking python novice as a refresher, so as not to tackle intermediate then advanced without a good review. but when I code, I confirm on another desktop (ubuntu 22.04) and it works. I'd like to have a button that says : [ my solution works, please accepts as-is] i.e. 1] Common Block : words = ["cat", "car", "code", "home", "learn", "fun", "job", "love", "friend", "zoo", "enjoy", "happiness", "family", "goal", "desire"] 2] sololearn : letter = input() for i in words: if letter in i: print(i) 3] mine : #your code goes here lettre=input("what is your letter: ") for word in words: if lettre in word: print (word They both give the same output .. I cannot hardcode the letter as it tests against multiple (random) ones.

26th May 2023, 6:20 PM
Marc Grondin
Marc Grondin - avatar
4 Respuestas
+ 6
Sololearn's answer checker is very picky about output, and considers everything written to the console to be part of your answer. Delete your input prompt and it should work.
26th May 2023, 6:28 PM
Orin Cook
Orin Cook - avatar
+ 2
The prompt is for human users. Sololearn checker does not need it.Using it adds unneccessary text in your output.
27th May 2023, 2:05 AM
Bob_Li
Bob_Li - avatar
+ 1
Marc Grondin It is not a problem of Sololearn it is a problem of your code. Sololearn output will only accept final result not your hard code string. For example if I say answer should be 'Yes' then only you have to print this not "what is your letter" So remove hard coded string from input() method. If you write anything inside input() method that would be also print.
27th May 2023, 7:04 AM
A͢J
A͢J - avatar
0
Marc Grondin (or anyone, really), what is the question/problem?
30th May 2023, 12:00 PM
Евгений
Евгений - avatar