First modules are files that contain definitions and statements that can be imported and used in other files, in this article we will be introduced to a well known module called random
.
Random module comes with a set of handy functions used to generate random values or manipulate arrays in a random way, here is alist of some functions and their use:
Function | description |
---|---|
Randint |
generates a random number between the entered arguments |
Random |
generates a random number between 0 and 1 |
Choice |
generates a random value from a set of values (like lists) |
Shuffle |
orders an array randomly in place |
Randrange |
generates a random number from a given range and a step |
The identification of any unwanted incident is called risk analysis, it serves as a key part in mitigating the risks, taking software industry in regard, these are the common risks that might be encountered:
One aspect to be familiar with is the risk magnitude indicators, these are:
The steps of risk analysis are:
see original article for more information
The percentage of tests passed a code may have might be tricky some times, and it does not necessarily reflect a perfect code. Instead of focusing on the number of tests passed, a more focus on the quality of tests passed must be taken into consideration. Giving a great focus on passing tests may result in writing tests that can easily be passed, make sure that your tests covers the edge cases of the problem your code solves, the different use cases of the code, and the different inputs it may deal with.
4 rules to take when calculating the Big O: