From 896c415abc215829ef87d7fde92ab5c8d4ae536f Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Mon, 6 Dec 2021 20:58:06 +0000 Subject: - Added guest contributions by Eric Cheung. --- challenge-142/eric-cheung/python/ch-2.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100755 challenge-142/eric-cheung/python/ch-2.py (limited to 'challenge-142/eric-cheung/python/ch-2.py') diff --git a/challenge-142/eric-cheung/python/ch-2.py b/challenge-142/eric-cheung/python/ch-2.py new file mode 100755 index 0000000000..bc6bf07135 --- /dev/null +++ b/challenge-142/eric-cheung/python/ch-2.py @@ -0,0 +1,19 @@ +## Sleep Sort (For Positive Numbers) +## Credit: https://gist.github.com/armorasha/47c7236cdfe25a928080692324d7f035 +## Credit: https://iq.opengenus.org/sleep-sort/ +## Python 3 + +import _thread +from time import sleep + +arrItem = [2, 4, 5, 2.5, 1, 7] + +def FuncSleepSort(nNum): + sleep(nNum) + print(nNum) + + +for nItem in arrItem: + argItem = (nItem,) + _thread.start_new_thread(FuncSleepSort, argItem) + -- cgit