Number Guessing Game - Build a Number Guessing Game

Please help.
I’ve finished writing and editing the commands but still can’t get through these tasks:
"1. When you run your script, you should prompt the user for a username with Enter your username:, and take a username as input. Your database should allow usernames that are 22 characters

2.If that username has been used before, it should print Welcome back, ! You have played <games_played> games, and your best game took <best_game> guesses., with being a users name from the database, <games_played> being the total number of games that user has played, and <best_game> being the fewest number of guesses it took that user to win the game

3.If the username has not been used before, you should print Welcome, ! It looks like this is your first time here.

4.The next line printed should be Guess the secret number between 1 and 1000: and input from the user should be read

5.Until they guess the secret number, it should print It’s lower than that, guess again: if the previous input was higher than the secret number, and It’s higher than that, guess again: if the previous input was lower than the secret number . Asking for input each time until they input the secret number.

6.If anything else than an integer is input as a guess, it should print That is not an integer, guess again:

7.When the secret number is guessed, your script should print You guessed it in <number_of_guesses> tries. The secret number was <secret_number>. Nice job! and finish running "

Below is the link and image of my script file, please help me. Show me my mistake to fix.
Thank you for watching.

My code so far
Link my code: “LearningFreecodecamp/number_guess.sh at 934f97e13b3597a97afb682d01b2b097bac0d40b · NPhucBinh/LearningFreecodecamp · GitHub
Link SQL and Code:
LearningFreecodecamp/Relational Database (Beta)/database number_guess at main · NPhucBinh/LearningFreecodecamp · GitHub

Below are pictures for the tasks that i am having trouble with

My browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/110.0.0.0 Safari/537.36

Challenge: Number Guessing Game - Build a Number Guessing Game

Link to the challenge:

It appears test are timming out when running script. They time out before completing the game, and they depend on finishing it.

The most time take queries to the database. Consider if it’s needed to update number of played games after every guess made by user.

1 Like

Oh thank you,
I want to ask if I need to set a guess limit, if the guess limit expires the program will exit or not?
Below is a picture of my database after running the test.
test program run results

Please help me point out my mistake, thank you.

There isn’t any limit for number of guesses in the requirements.

Hi Binh, I had the same issue (especially tasks 7, 8 and 11 failing randomly, 9 and 10 failing sometimes).
After pressing “Run” maybe a hundred times (or even more) without changing the code, tests eventually passed just as randomly as they failed before. Best of luck to you.

1 Like

oh thank you i will try to find another way.

Thank you for your encouragement and sharing.
I will try again and hope to get over this issue soon.
Thanks again for your feedback.
Have a nice day!