39.3k views
0 votes
Which line of code needs to be included before you can execute

num = random.randint(1,10)?

Group of answer choices

create random

import random

import randint

randint = random

User Bguiz
by
8.4k points

1 Answer

4 votes

Answer: The line of code that needs to be included before you can execute num = random.randint(1,10) is:

import random

Explanation: This line of code imports the random module in Python, which contains functions for generating random numbers.

Once you have imported the random module, you can use the randint() function to generate a random integer between two specified values. In this case, we are generating a random integer between 1 and 10.

I hope that helps, and have a great day!

User Maroux
by
7.8k points