@Ankita ,This is very simple ,just use the random.randint(x,y):

It returns random integers M such that randrange(x,y+1) , where x <= M <= y .

Use this code to generate random int between 0 to 9:

from random import randintprint(randint(0, 9))

from random import randint

print(randint(0, 9))

Hope this answer helps.

import randomprint(random.randint(0,9))random.randint(a, b)

import random

print(random.randint(0,9))

random.randint(a, b)

This returns a random integer N such that a <= N <= b.

You can use the following video tutorials to clear all your doubts:-