Contenu du cours

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.


Évaluation
0 0

Il n'y a aucun commentaire pour le moment.

pour être le premier à laisser un commentaire.