forked from gil9red/SimplePyScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
22 lines (15 loc) · 648 Bytes
/
Copy pathmain.py
File metadata and controls
22 lines (15 loc) · 648 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
__author__ = "ipetrash"
import random
direction = ["up", "down", "left", "right"]
for i in range(5):
print(
f"Directions: {direction}, random direction = {random.choice(direction)}"
)
print(f"random: {random.random()}") # rand float number
print(f"randrange(5): {random.randrange(5)}") # rand int number
print(f"randrange(0, 10): {random.randrange(0, 10)}") # rand int number
print(f"uniform(1, 10): {random.uniform(1, 10)}") # rand float number
print(f"Directions: {direction}")
random.shuffle(direction) # shuffle list
print(f"Shuffle directions: {direction}")
print(random.sample(direction, 2)) # select two element