143k views
2 votes
Complete the code to generate a pseudo-random integer between 1 and 44, including the possibility of both 1 and

44.
>>> import secrets
>>> secret

User Meises
by
7.5k points

1 Answer

3 votes

Answer:

Step-by-step explanation:

.randbelow(44) + 1

The code above uses the secrets module, which is a part of the Python standard library and uses a cryptographically strong random number generator. The randbelow() function generates a random integer below the number given as an argument. In this case, the argument is 44, which means that the function will generate a random integer between 0 and 43. To get a random integer between 1 and 44, we add 1 to the result of the function.

User Vishnu Kunchur
by
7.8k points