Skip to content

Instantly share code, notes, and snippets.

@littlekfc
Created March 21, 2020 11:57
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save littlekfc/74c9d74ec45debbe991e7e6d3030be31 to your computer and use it in GitHub Desktop.
Save littlekfc/74c9d74ec45debbe991e7e6d3030be31 to your computer and use it in GitHub Desktop.
Answer
#!/usr/bin/python
# -*- coding: utf-8 -*-
total = [(i, j, ii, jj) for i in xrange(2) for j in xrange(7) for ii in xrange(2) for jj in xrange(7)]
filled_total = 0
case_total = 0
for case in total:
if (case[0] == 1 and case[1] == 1) or (case[2] == 1 and case[3] == 1):
case_total += 1
if (case[0] == 1 and case[1] == 1 and case[2] == 1) or (case[0] == 1 and case[2] == 1 and case[3] == 1):
filled_total += 1
print '%s/%s' % (filled_total, case_total)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment