Which of these lines of code will generate a random number between 1 and 50?

(1 point)
• input(*1-50") |
• print("1-50") |
• import random
• num = random.randint(1,50)|

1 answer

The line of code that will generate a random number between 1 and 50 is:

num = random.randint(1, 50)

This line uses the randint function from the random module to generate a random integer between the two specified values (1 and 50, inclusive).