Questions about the code

tic = time.time()
c = np.dot(a,b)
toc = time.time()

print(toc-tic)

Just wanna ask how tic and toc work here… Thanks…

Hi @Wz111 , welcome to the DLS !

You have a very detailed description of each standard Python module and it’s functions, including time, in the Python Standard Library page.

Here you are just checking how much time the np.dot() took.

1 Like

Hello wz111, I think that tic and toc are variables which are storing the value of the time say in float datatype. ‘tic’ is saving the value at the start of the function and ‘toc’ after executing the function.
And hence their difference give the amount of time taken.
Please correct if I am wrong.

1 Like