How should I do this test cases | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How should I do this test cases

In the frequency analyzer project, there are two test cases, I have coded the answer to both, but I don't know how to run them individually.

27th Mar 2021, 2:30 PM
TEKO SAMUEL OGALA
TEKO SAMUEL OGALA - avatar
6 Answers
+ 3
You need to write a code that will work for any input, not just that 2 test cases. You can use input() method to take the input from the compiler , then manipulate what you get into what you need to output. Btw, it would be good if you show your code.
27th Mar 2021, 3:18 PM
Simba
Simba - avatar
+ 2
TEKO SAMUEL OGALA You don't hard-code your solutions so that they only work for certain test cases. The aim is to code it so that it will work for ANY test case. A test case involves giving your code some input, and checks whether the output of your code is correct. Your code needs to take the input using input(), and return the output using print().
27th Mar 2021, 3:57 PM
Russ
Russ - avatar
+ 1
If you want to run a code on Sololearn then, ➡️ Go to the Code Playground section (you can find it here : https://code.sololearn.com) and click on the + icon at the bottom right corner. ➡️ Then select python and write your code and save it. ➡️ Then click on Run and your Code will get executed.
27th Mar 2021, 3:29 PM
Yaroslav Vernigora
Yaroslav Vernigora - avatar
0
I don't know how to share code.
27th Mar 2021, 3:20 PM
TEKO SAMUEL OGALA
TEKO SAMUEL OGALA - avatar
0
But the first test case is actually correct.
27th Mar 2021, 3:22 PM
TEKO SAMUEL OGALA
TEKO SAMUEL OGALA - avatar
0
Even the second , when I run my code
27th Mar 2021, 3:22 PM
TEKO SAMUEL OGALA
TEKO SAMUEL OGALA - avatar