форкнуто от main/python-labs
Вы не можете выбрать более 25 тем
Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.
41 строка
1.7 KiB
Python
41 строка
1.7 KiB
Python
Python 3.13.7 (tags/v3.13.7:bcee1c3, Aug 14 2025, 14:15:11) [MSC v.1944 64 bit (AMD64)] on win32
|
|
Enter "help" below or click "Help" above for more information.
|
|
import math
|
|
import cmath
|
|
import time
|
|
import random
|
|
import string
|
|
import statistics
|
|
math.floor((round(cmath.phase(0.2+0.8j), 2) * 20) / 3), (round(cmath.phase(0.2+0.8j), 2) * 20) % 3
|
|
(8, 2.6000000000000014)
|
|
time.localtime(time.time() + 3 * 3600)
|
|
time.struct_time(tm_year=2025, tm_mon=9, tm_mday=19, tm_hour=20, tm_min=42, tm_sec=40, tm_wday=4, tm_yday=262, tm_isdst=0)
|
|
moscow_time = time.localtime(time.time() + 3 * 3600) # UTC+3 для Москвы
|
|
current_time_str = f"{moscow_time.tm_hour:02d}:{moscow_time.tm_min:02d}"
|
|
moscow_time
|
|
time.struct_time(tm_year=2025, tm_mon=9, tm_mday=19, tm_hour=20, tm_min=43, tm_sec=20, tm_wday=4, tm_yday=262, tm_isdst=0)
|
|
>>> current_time_str
|
|
'20:43'
|
|
>>> week_days = ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье']
|
|
>>> random_days = random.sample(week_days, 3)
|
|
>>> random_days
|
|
['Вторник', 'Пятница', 'Воскресенье']
|
|
>>> sequence = list(range(14, 33, 3))
|
|
>>> random_number = random.choice(sequence)
|
|
>>> random_number
|
|
20
|
|
>>> sequence
|
|
[14, 17, 20, 23, 26, 29, 32]
|
|
>>> N = round(random.gauss(15, 4))
|
|
>>> N = max(1, N) # Гарантируем хотя бы 1 элемент
|
|
>>> random_letters = random.choices(string.ascii_uppercase, k=N)
|
|
>>> N
|
|
11
|
|
>>> random_letters
|
|
['O', 'U', 'J', 'Y', 'U', 'Y', 'Y', 'S', 'D', 'K', 'G']
|
|
>>> current_time = time.time()
|
|
>>> time_interval_seconds = current_time - time.mktime(moscow_time)
|
|
>>> time_interval_minutes = round(time_interval_seconds / 60, 2)
|
|
>>> time_interval_minutes
|
|
-170.05
|