Skip to content

Instantly share code, notes, and snippets.

@fogside
Created April 21, 2016 14:46
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 fogside/13fa35ad0cd70fba7472d4c83c6d0372 to your computer and use it in GitHub Desktop.
Save fogside/13fa35ad0cd70fba7472d4c83c6d0372 to your computer and use it in GitHub Desktop.
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
"""
Summer School problem.
usage:
http letnyayashkola.org/api/v1.0/workshop-programs/ | ./script.py
"""
import numpy as np
import json
import sys
"""
in each [0,0] of cycles_sch:
first -- how many facilities participate
second -- how many only school programs
"""
cycles_sch = np.array([0]*10).reshape(5,2)
school = 0
f = unicode(sys.stdin.readline(),'unicode_escape')
json_dict = json.loads(f)
for mastersk in json_dict:
if (u"кольн" in mastersk["looking_for"]) and (u"тудент" not in mastersk["looking_for"]):
if u"от 18 лет" not in mastersk["age_restriction"]:
school = 1
for date in mastersk["dates"]:
cycles_sch[date["cycle_n"]][0]+=1
if school:
cycles_sch[date["cycle_n"]][1]+=1
school = 0
for i in range(1,len(cycles_sch)):
print u"Цикл {0}: всего программ {1}, из них школьных: {2}".format(i, cycles_sch[i][0], cycles_sch[i][1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment