“Tip Calculator” and coach coding practice not working properly | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

“Tip Calculator” and coach coding practice not working properly

I had a problem with tip calculator-I passed test case #1 but when it took me to TC #2, the code for TC#1 transferred to TC#2 and sent a “try again” msg. When I would redo the coding for TC #2, I would get a green check for TC #2 but then TC#1 had a red X and “try again” msg. The same goes on in the coach practice questions. Needless to say I’m not getting points for correctly coding. Am I doing something wrong?

18th Oct 2021, 4:01 AM
Kathleen Martinez
3 Answers
+ 1
The spirit of code assignments like code coach is being able to get the correct output based on the input. If you can do it, you solve the assignment. Let's say your program needs to calculate the square of an integer. If the input is 3, your code should print 9. If the input is 5, your code should print 25. This is all done in 1 program, 1 code. You need to implement a logic that satisfies any given value. It's not correct to write 3 * 3 in a code, 5 * 5 in another. You instead should write n * n, where n is given from the input.
18th Oct 2021, 4:47 AM
你知道規則,我也是
你知道規則,我也是 - avatar
+ 1
If you link your code, we can help you to figure out why the code isn't working
18th Oct 2021, 5:25 AM
Lisa
Lisa - avatar
0
Thank you. I was over-thinking it. I got it.
19th Oct 2021, 3:41 AM
Kathleen Martinez