|
|
|
|
@ -27,11 +27,13 @@
|
|
|
|
|
```
|
|
|
|
|
### Задача 2
|
|
|
|
|
```py
|
|
|
|
|
>>> import time
|
|
|
|
|
>>> time.localtime()
|
|
|
|
|
time.struct_time(tm_year=2025, tm_mon=10, tm_mday=8, tm_hour=13, tm_min=10, tm_sec=51, tm_wday=2, tm_yday=281, tm_isdst=0)
|
|
|
|
|
>>> str(time.localtime().tm_hour) + ':' + str(time.localtime().tm_min)
|
|
|
|
|
'13:13'
|
|
|
|
|
import time
|
|
|
|
|
time.localtime()
|
|
|
|
|
time.struct_time(tm_year=2025, tm_mon=10, tm_mday=24, tm_hour=11, tm_min=44, tm_sec=47, tm_wday=4, tm_yday=297, tm_isdst=0)
|
|
|
|
|
|
|
|
|
|
str(time.localtime().tm_hour) + ':' + str(time.localtime().tm_min)
|
|
|
|
|
'11:45'
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|

|
|
|
|
|
### Задача 3
|
|
|
|
|
@ -50,34 +52,35 @@ time.struct_time(tm_year=2025, tm_mon=10, tm_mday=8, tm_hour=13, tm_min=10, tm_s
|
|
|
|
|
>>> [i for i in range(14,33, 3)]
|
|
|
|
|
[14, 17, 20, 23, 26, 29, 32]
|
|
|
|
|
>>> random.choice([i for i in range(14,33, 3)])
|
|
|
|
|
29
|
|
|
|
|
14
|
|
|
|
|
>>> random.choice([i for i in range(14,33, 3)])
|
|
|
|
|
20
|
|
|
|
|
32
|
|
|
|
|
```
|
|
|
|
|
### Задача 5
|
|
|
|
|
```py
|
|
|
|
|
>>> N = random.gauss(15,4)
|
|
|
|
|
>>> N
|
|
|
|
|
13.338543069074923
|
|
|
|
|
>>> round(N)
|
|
|
|
|
13
|
|
|
|
|
>>> alphabet = 'qwertyuiopasdfghjklzxcvbnm'
|
|
|
|
|
>>> alphabet = list(alphabet); alphabet
|
|
|
|
|
import random
|
|
|
|
|
N = random.gauss(15,4)
|
|
|
|
|
N
|
|
|
|
|
21.63802181652703
|
|
|
|
|
round(N)
|
|
|
|
|
22
|
|
|
|
|
alphabet = 'qwertyuiopasdfghjklzxcvbnm'
|
|
|
|
|
alphabet = list(alphabet); alphabet
|
|
|
|
|
['q', 'w', 'e', 'r', 't', 'y', 'u', 'i', 'o', 'p', 'a', 's', 'd', 'f', 'g', 'h', 'j', 'k', 'l', 'z', 'x', 'c', 'v', 'b', 'n', 'm']
|
|
|
|
|
>>> [random.choice(alphabet) for i in range(round(N))]
|
|
|
|
|
['k', 'f', 'l', 'd', 'g', 'd', 'x', 'p', 'j', 'x', 't', 'q', 'c']
|
|
|
|
|
>>> [random.choice(alphabet) for i in range(round(N))]
|
|
|
|
|
['x', 'a', 'i', 'c', 'v', 'a', 't', 'z', 'b', 'm', 'u', 'p', 'g']
|
|
|
|
|
[random.choice(alphabet) for i in range(round(N))]
|
|
|
|
|
['a', 'g', 'q', 'd', 'p', 'u', 'h', 't', 'x', 'e', 'f', 'b', 'u', 'b', 'n', 'a', 'i', 'm', 'f', 'v', 's', 'h']
|
|
|
|
|
[random.choice(alphabet) for i in range(round(N))]
|
|
|
|
|
['n', 'c', 'l', 'a', 'b', 'a', 'f', 's', 'k', 'f', 'b', 'z', 'x', 'i', 'f', 'j', 'a', 'a', 'r', 'f', 'e', 'a']
|
|
|
|
|
```
|
|
|
|
|
### Задача 6
|
|
|
|
|
```py
|
|
|
|
|
>>> c1 = time.time()
|
|
|
|
|
>>> c1
|
|
|
|
|
1759919247.2307003
|
|
|
|
|
>>> c2 = time.time(); c2
|
|
|
|
|
1759919725.6270442
|
|
|
|
|
>>> c2 - c1
|
|
|
|
|
478.3963439464569
|
|
|
|
|
>>> (c2 - c1)//60
|
|
|
|
|
7.0
|
|
|
|
|
cl=time.time()
|
|
|
|
|
cl
|
|
|
|
|
1761295704.2733138
|
|
|
|
|
c2 = time.time(); c2
|
|
|
|
|
1761295714.731917
|
|
|
|
|
c2 - c1
|
|
|
|
|
25.22442126274109
|
|
|
|
|
(c2 - c1)//60
|
|
|
|
|
0.0
|
|
|
|
|
```
|
|
|
|
|
|