0

The "say the numbers" exercise in the Go tutorial

Hi guys! I'm python dev learning Go; but I'm a bit confused. The "say the numbers" exercise requires you to take three numbers between 0 and 10, and then print their English equivalent line by line. My solution gets past all the tests but the third one (which is locked and thus unknown). Can someone help?

16th Jun 2022, 11:46 PM
AzuraMask
9 Antworten
+ 1
AzuraMask You can share your code bit and then someone can let you know if you did correctly. Or you can test the case yourself: since this one wants you to input a number and print out the text and it only goes to 10. Then input each number to see if it prints the text for each number 0-10.. https://www.sololearn.com/Discuss/2880776/i-wrote-the-following-code-for-the-say-the-numbers-project-in-the-go-tutorial-but-it-doesn-t-pass-2
17th Jun 2022, 2:37 AM
Chris Coder
Chris Coder - avatar
+ 2
Chris Coder pro users cannot see more test cases than free users. They're hidden to prevent hardcoding the answers. Since sololearn doesn't check the code but only compares the output for each input to the expected output you could just solve all tasks with a few if statements.
17th Jun 2022, 8:35 PM
Simon Sauter
Simon Sauter - avatar
+ 1
I assume to help users figure out if they're completely off the mark.
17th Jun 2022, 8:39 PM
Simon Sauter
Simon Sauter - avatar
+ 1
AzuraMask I used a switch statement with fmt.Println rather than print. I did not have a default case.
18th Jun 2022, 8:44 PM
Paul K Sadler
Paul K Sadler - avatar
0
Jay Matthews it is possible that the app post the same thing twice. Sometimes my answers appear twice.
17th Jun 2022, 2:06 AM
Chris Coder
Chris Coder - avatar
0
IDK why that happened. Removed the duplicate. Can some1 help?
17th Jun 2022, 2:10 AM
AzuraMask
0
Thanks. Also, what a great approach! "It's free, but we'll make it impossible to understand what's wrong with your code!"
17th Jun 2022, 2:22 AM
AzuraMask
0
Appreciated. Thanks a lot.
17th Jun 2022, 2:45 AM
AzuraMask
0
Simon Sauter Thanks for the correction. I had pro but wasn't sure if I remembered correctly. What is the point of showing that are other test cases?
17th Jun 2022, 8:38 PM
Chris Coder
Chris Coder - avatar