Random in Python

random.randomrandom.randintrandom.uniformrandom.randrangerandom.choicerandom.samplerandom.shufflerandom.seed
Задание 1

Two integers are given:

pythonnum1 = 10
num2 = 20

Generate a random integer from the range given by our numbers.

Задание 2

Two integers are given:

pythonnum1 = 5
num2 = 30

Generate a pseudo-random integer from the range given by our numbers.

Задание 3

Given two fractional numbers:

pythonnum1 = 1.345
num2 = 14.784

Generate a pseudo-random real number from the range given by our numbers.

Задание 4

Two integers are given:

pythonnum1 = -2
num2 = 10

Generate a random real number from the range given by our numbers.

Задание 5

Three numbers are given:

pythonnum1 = 5
num2 = 50
num3 = 4

Generate a random number from the range specified by the first and second numbers. Let the third number determine the sampling step.

Задание 6

Given a list:

pythonlst = [1, 2, 3, 4, 5]

Get a random item from this list.

Задание 7

Given a list:

pythonlst = [1, 2, 3, 4, 5]

Get a new list consisting of three random elements of the original list.

Задание 8

Given a list:

pythonlst = [1, 2, 3, 4, 5]

Shuffle the items in this list in random order.

Задание 9

The list with duplicates is given:

pythonlst = [1, 1, 1, 2, 2, 3, 3, 4, 5]

Get three random elements from the list so that no elements are repeated in the sample.

Задание 10

Given a number:

pythonnum = 7

Initialize it.

Задание 11

Given a tuple:

pythontlp = (10, 6, 2, 4)

Get a random number from it and then initialize it.