Code refactoring is crucial but often overlooked. It can improve the design and performance of existing code.
The Python code below takes about 12 seconds to execute. Refactor the
getData function to make it run in less than 1 second. Post your answer in the comments.
import timedef getData():
arr = 
for i in range(1000*1000*100):
Tstart = time.time()
Tend = time.time()
Tdt = round(Tend - Tstart, 2)