PHP
- 1 ответ
- 0 вопросов
1
Вклад в тег
i = hash(key) % hash_table_len
hash_table[i] = value
i = hash(key) % hash_table_len
value = hash_table[i]
>>> help(Process.join)
join(self, timeout=None)
Wait until child process terminates
from multiprocessing import Process
from time import sleep
def worker(n):
print("the worker went to the office")
sleep(n)
print("the worker has been walking for %d sec" % n)
if __name__ == "__main__":
plist = []
for i in range(4, 0, -1):
proc = Process(target=worker, args=(i,))
plist.append(proc)
for proc in plist:
proc.start()
the worker went to the office
the worker went to the office
the worker went to the office
the worker went to the office
the worker has been walking for 1 sec
the worker has been walking for 2 sec
the worker has been walking for 3 sec
the worker has been walking for 4 sec
from matplotlib import pyplot as plt
import numpy as np
#функция
x = np.arange(0.1, 10, 1*(10**-2))
y = np.sin(x) + np.log(x)
#полином 1 степени по функции
p = np.polyfit(x,y, 1)
#подставляем значения x к полученному полиному
ya = np.polyval(p, x)
plt.plot(x, y)
plt.plot(x, ya)
plt.show()