A practical way of doing that's using the random
library. Let's import it:
import random
Among the random
methods, there is the randint
method, that returns an integer value within a specified range.
random.randint(0,10)
Just use a variable to store the value the function will return and that's it, we can display the value the computer thought.
x = random.randint(0,10)
print(x)
Top comments (0)