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
19 lines (14 loc) · 720 Bytes
/
Copy pathmain.py
File metadata and controls
19 lines (14 loc) · 720 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
__author__ = 'ipetrash'
import random
if __name__ == '__main__':
direction = ["up", 'down', 'left', 'right']
for i in range(5):
print("Directions: %s, random direction = %s" % (direction, random.choice(direction)))
print("random: %s" % random.random()) # rand float number
print("randrange(5): %s" % random.randrange(5)) # rand int number
print("randrange(0, 10): %s" % random.randrange(0, 10)) # rand int number
print("uniform(1, 10): %s" % random.uniform(1, 10)) # rand float number
print("Directions: %s" % direction)
random.shuffle(direction) # shuffle list
print("Shuffle directions: %s" % direction)
print(random.sample(direction, 2)) # select two element