The task you have to perform is “Guess The number”. This task consists of a total of 10 points to evaluate your performance.
Generate a random integer from a to b. You and your friend have to guess a number between two numbers a and b. a and b are inputs taken from the user. Your friend is player 1 and plays first. He will have to keep choosing the number and your program must tell whether the number is greater than the actual number or less than the actual number. Log the number of trials it took your friend to arrive at the number. You play the same game and then the person with minimum number of trials wins! Randomly generate a number after taking a and b as input and don’t show that to the user.
Enter the value of a
Enter the value of b
Please guess the number between 4 and 13
Wrong guess a greater number again
Wrong guess a smaller number again
Correct you took 3 trials to guess the number
Correct you took 7 trials to guess the number
Player 1 wins!
Accepting a coding challenge is an excellent way to improve your coding skills. So, keep practicing and keep yourself up to date with codewithharry.
No downloadable resources for this video. If you think you need anything, please post it in the QnA!
Any Course related announcements will be posted here