CBSE Class 11 Computer Science Question 49 of 63

Introduction to Python Modules — Question 18

Back to all questions
18
Question

Question 18

Write a Python program to generate a random number between 0 and 9.

Solution
import random
random_number = random.randint(0, 9)
print("Random number between 0 and 9:", random_number)
Output
Random number between 0 and 9: 2

Random number between 0 and 9: 3
Answer