/
ilya.petrash
/
SimplePyScripts
Обзор
Документация
Войти
/
ilya.petrash
/
SimplePyScripts
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
Random_example/main.py
22 строки
648 B
gil9red
Refactoring. Using black code style
14 июн 2023, 11:46
14 июн 2023, 11:46
5fe3784
Код
Авторство
О чём код?
__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