Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
ok I made it in pycharm to work fine with first 5 test numbers (0,1,4,56,128) and its working
but codewars cant handle it with its resources when applying huge numbers with 5+ digits in it
here we go
amount = [0]
def num_of_open_lockers(xx):
xx = int(xx)
global amount, studentsamount
studentsamount = xx
amount = amount*xx
if xx == 0:
return 0
if xx == 1:
return 1
else:
for i in range(1, xx + 1):
studentsaction(i)
return amount.count(1)
def studentsaction(x):
global amount, studentsamount
if x == 1:
for i in range(1, studentsamount+1):
switch(i-1)
else:
for i in range(1, studentsamount+1):
if i%x==0:
switch(i-1)
def switch(locknum):
global amount
if amount[locknum] == 0:
amount[locknum] = 1
else:
amount[locknum] = 0