Этот коммит содержится в:
Ksenia
2025-10-06 12:09:15 +03:00
родитель 5e08ec6d4e
Коммит 172a6784df
2 изменённых файлов: 27 добавлений и 47 удалений

Просмотреть файл

@@ -3,8 +3,9 @@
## 1.
import cmath
a = tuple([((round(cmath.phase(0.2+0.8j),2)) * 20)// 3] + [((round(cmath.phase(0.2+0.8j),2)) * 20) % 3])
print(a)
n = ((round(cmath.phase(0.2+0.8j),2)) * 20)
a, b = divmod(n, 3)
print(a,b)
## 2.
import time
@@ -15,32 +16,21 @@ start_time = time.time()
## 3.
import random
spis = ['Понедельник', 'Вторник', 'Среда', 'Четверг', 'Пятница', 'Суббота', 'Воскресенье']
i = 0
l = []
while i != 3:
a = random.choice(spis)
if a not in l:
l.append(a)
i += 1
l = random.sample(spis, 3)
print(l)
## 4.
import random
print(random.randrange(14,32,3))
num = list(range(14, 32, 3))
res = random.choice(num)
print(res)
## 5.
import random
N = round((random.gauss(15, 4)))
l = []
c = []
k = 0
for i in range(65, 91): # ASCII коды от A (65) до Z (90)
l.append(chr(i))
while k != N:
r = random.choice(l)
if r not in c:
c.append(r)
k += 1
import string
N = round(random.gauss(15, 4))
l = string.ascii_uppercase
c = random.sample(l, N)
print(c)
print(N)
print(f'Длина массива: {len(c)}')