in Education by
Generate random integers between 0 and 9 In Python, How do I generate random integers between 0 to 9 ? Select the correct answer from above options

1 Answer

0 votes
by
 
Best answer
@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 randint print(randint(0, 9)) Hope this answer helps.

Related questions

0 votes
    In Python how can I convert an integer to a string? I am trying this: r = 16 r.str() I am trying to ... but there's nothing like that. Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    I am trying to generate 10,000 unique random integers in the range of 1 to 20,000 to store in a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 12, 2022 in Education by JackTerrance
0 votes
    I am trying to generate 10,000 unique random integers in the range of 1 to 20,000 to store in a ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 10, 2022 in Education by JackTerrance
0 votes
    Two numbers are selected at random from integers 1 through 9. If the sum is even, find the probability that both the numbers are odd. Select the correct answer from above options...
asked Nov 13, 2021 in Education by JackTerrance
0 votes
    In [31]: print(np.poly1d((3,2))) 3 x + 2 In [32]: a = np.array(( np.poly1d( ... JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I am trying to alter the data in the panda's df. Using below, where X >=5, I want to change the corresponding Y row to 1. Where X...
asked Jan 19, 2022 in Education by JackTerrance
0 votes
    This is my function: def sub(number): tmp = [] tmp.append(number) while len(str(number)) > 1: tmp.append( ... do this in the python? Select the correct answer from above options...
asked Jan 9, 2022 in Education by JackTerrance
0 votes
    If the integers m and n are chosen at random between 1 and 100, then the probability that a number of the form 7m+7n ... . 1 8 D. 1 49 Select the correct answer from above options...
asked Nov 13, 2021 in Education by JackTerrance
0 votes
    A bag contains 10 tickets numbered 0, 1,2 ....9. Two tickets are drawn at random simultaneously. What is ... the other ticket number. Select the correct answer from above options...
asked Nov 25, 2021 in Education by JackTerrance
0 votes
    How can I generate a string of size N. I want it to be of uppercase English letters and numbers like this: 7I2D86 ... do it in Python. Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    Say I have a DataFrame full of positive samples and context features for a given user: target user cashtag ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 26, 2022 in Education by JackTerrance
0 votes
    So for a HW assignment, we're making a Yahtzee game. At least part of it. For preparation, our ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
0 votes
    Please tell me what random.seed() does in Python. For example, why do the below trials do what they do ( ... randint(1, 10) 7 Select the correct answer from above options...
asked Jan 21, 2022 in Education by JackTerrance
...