Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.

Categories

+3 votes
asked in CSC201 Spring 2021 by (1 point)

1 Answer

+7 votes

They are all used for different motives:

For random.randrange() you want to generate a random number from a specific range. They can be an integer or float depending on the range and the step you create.

For random.choice(), it intends to select a random element of a list from a specific sequence. They can be a string, a list, or even a range. There also possible to create the probability of each element in the list. In another word, you can tell Python that this particular value is more likely to be generated over the others

For random.seed(), from what I researched, the function is working as a randomly generated. As for the computer, there is no random! Therefore, using this can help you manipulate the randomness of a sequence of values. I don’t know if my assumption is right, but I think that computers have included every possibility of events to occurs. The ‘seed’ is the starting point of a sequence of a specific event.

answered by (1 point)
+1

Thank you, makes sense, I was wondering why the random. seed() was necessary.

...