Computer Science, asked by KIRTIRAJ7439, 1 year ago

What does the function random.randrange(50,100) return in Python?

Answers

Answered by poojan
12

It returns a random number between 50 and 99 (both inclusive).

Explanation:

randrange(startvalue, stopvalue) returns values between start and stop values, where start value is inclusive and stop value is excluded. So, the function returns a value between the start value and stop value - 1 inclusively.

However, If you want to include the stopvalue too, you can use another random function named 'ran dint()'

 

  • randrange is a python's inbuilt function in the class random. It returns a random value from the given range.

  • To access this function, first, we need to import 'random' module.

  • randrange function takes three parameters start value, stop value, point range (Optional; by default : 1), in the same order.

import random

random.randrange(startvalue(inclusive), stopvalue(excluded), rangingvalue(optional))

Learn more :

 

1) Write a python program to generate random no.​

brainly.in/question/15069095

2) How to generate random numbers in Python ?

brainly.in/question/16087795

Similar questions