From ee0d2ae41449f68b3ac874e526c6b140e7d3e909 Mon Sep 17 00:00:00 2001 From: Mohammad S Anwar Date: Thu, 6 Feb 2020 14:35:09 +0000 Subject: - Added Python solutions by Orestis Zekai. --- challenge-046/orestis-zekai/python/ch-2.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 challenge-046/orestis-zekai/python/ch-2.py (limited to 'challenge-046/orestis-zekai/python/ch-2.py') diff --git a/challenge-046/orestis-zekai/python/ch-2.py b/challenge-046/orestis-zekai/python/ch-2.py new file mode 100644 index 0000000000..b86235f21a --- /dev/null +++ b/challenge-046/orestis-zekai/python/ch-2.py @@ -0,0 +1,19 @@ +rooms = 500 +employees = 500 + +# The first employee opens all the doors +doors = [1 for i in range(0,rooms)] + +for i in range(1, employees): + j = i + step = i + 1 + while (j < 500): + if (doors[j] == 0): + doors[j] = 1 + else: + doors[j] = 0 + + j += step + +print(doors) +print(sum(doors)) \ No newline at end of file -- cgit