Skip to content
This repository was archived by the owner on Mar 1, 2020. It is now read-only.

Commit 0523492

Browse files
committed
Added about random numbers
1 parent 1ee7870 commit 0523492

File tree

1 file changed

+26
-1
lines changed

1 file changed

+26
-1
lines changed

README.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,34 @@ To write a function in Python, you start the function out with the "def" keyword
1818
### Example
1919

2020
```python
21-
def
21+
def myFunction (param1, param2, param3):
22+
sum = param1 + param2 + param3
23+
return sum
2224
```
2325

26+
## Random Number
27+
28+
Random nubmers can be used to do countdowns or other things that are needed.
29+
To get a random number, you have to import the randomint class from the random library
30+
by adding
31+
32+
```
33+
from random import randint
34+
```
35+
36+
to the top of your Python script.
37+
38+
Then you can set the random integer to a variable by doing
39+
40+
```
41+
myNumber = randint(5,60)
42+
```
43+
44+
In the example above, 5 is the lower limit of the range and 60 is the upper limit
45+
of the range. If your range needs to be different, then changes either or both of
46+
these values.
47+
48+
2449
## More Resources
2550

2651
The Raspberry Pi traffic light project is written in Python code. You can review the

0 commit comments

Comments
 (0)