import time
from multiprocessing import Process


####### SINGLE THREAD

def ask_user():

	start = time.time()

	user_input = input('Enter your name: ')

	greet = f'Hello, {user_input}'
	print(greet)
	print('ask_user: ', time.time() - start)


def complex_calculation():

	print('Started calculating...')
	start = time.time()
	[x**2 for x in range(20000000)]
	print('complex_calculation: ', time.time() - start)


# With a single thread, we can do one at a time—e.g.
start = time.time()
ask_user()
complex_calculation()
print('Single thread total time: ', time.time() - start, '\n\n')


process = Process(target=complex_calculation())
process2 = Process(target=ask_user())

if __name__ == "__main__":
	process.start()
	process2.start()
	start = time.time()
	ask_user()
	process.join()
	process2.join()


print(f'Two process total time: {time.time() -start}')