Skip to content

Instantly share code, notes, and snippets.

@akibmayadav
Created January 27, 2017 01:21
Show Gist options
  • Save akibmayadav/31b4a6e43b25e1132198739f58b590d0 to your computer and use it in GitHub Desktop.
Save akibmayadav/31b4a6e43b25e1132198739f58b590d0 to your computer and use it in GitHub Desktop.
# Ambika Yadav
# MAT 594E : Open/ Close Doors
doorlist = ["closed"]*100
for i in range(1,101):
for j in range(1,101):
if (j*i <100):
if(doorlist[(j*i)-1]=="closed"):
doorlist[(j*i)-1] ="open" ;
else :
doorlist[(j*i)-1] ="closed";
for i in range(0,len(doorlist)):
if (doorlist[i] == "open"):
print("Door Number " + str(i+1) + " is " + doorlist[i]);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment