Friday, March 15, 2019

The Guessing Game!

Here is a simple and fun, number guessing game. This game illustrates the use of the function randint() from the random library.

A little about the randint() funtion:
The randint() function takes 2 numbers as arguments and returns a random number between the 2 numbers (inclusive of the lower and upper limit numbers). The randint() function is used as shown below,

import random
c = random.randint(50,250)
print(c)

Here, a random number between 50 and 250 will be stored in c. Both 50 and 250 are also included in the range.

Code for the Guessing Game:

No comments: