Contenido del curso

Random number between 1 & 100

Write a program that generates a random number between 1 and 100 and asks the user to guess the number. Provide hints such as "Too high" or "Too low" until the user guesses the correct number. Track the number of attempts and display it when the user guesses correctly.

Generated random number: 67

Input: 50

Output: Too low. Try again.

Input: 80

Output: Too high. Try again.

Input: 67

Output: Congratulations! You guessed the correct number in 3 attempts.


Write a program that generates a random number between 1 and 100 and asks the user to guess the number. Provide hints such as "Too high" or "Too low" until the user guesses the correct number. Track the number of attempts and display it when the user guesses correctly.

Generated random number: 67

Input: 50

Output: Too low. Try again.

Input: 80

Output: Too high. Try again.

Input: 67

Output: Congratulations! You guessed the correct number in 3 attempts.


Rating
0 0

No hay comentarios por ahora

to be the first to leave a comment.