curriculum/challenges/english/blocks/daily-coding-challenges-python/68cae5b538ff798bbd4da007.md
Given an integer representing the number of pairs of socks you started with, and another integer representing how many wash cycles you have gone through, return the number of complete pairs of socks you currently have using the following constraints:
sock_pairs(2, 5) should return 1.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sock_pairs(2, 5), 1)`)
}})
sock_pairs(1, 2) should return 0.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sock_pairs(1, 2), 0)`)
}})
sock_pairs(5, 11) should return 4.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sock_pairs(5, 11), 4)`)
}})
sock_pairs(6, 25) should return 3.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sock_pairs(6, 25), 3)`)
}})
sock_pairs(1, 8) should return 0.
({test: () => { runPython(`
from unittest import TestCase
TestCase().assertEqual(sock_pairs(1, 8), 0)`)
}})
def sock_pairs(pairs, cycles):
return pairs
def sock_pairs(pairs, cycles):
socks = pairs * 2
for i in range(1, cycles + 1):
if i % 2 == 0:
socks -= 1
if i % 3 == 0:
socks += 1
if i % 5 == 0:
socks -= 1
if i % 10 == 0:
socks += 2
if socks < 0:
socks = 0
return socks // 2