Updated req_writer to allow for BA and BS requirements, main_writer emits...

Updated req_writer to allow for BA and BS requirements, main_writer emits warnings if there is an invalid course in a transcript
parent 0391b17f
......@@ -29,12 +29,17 @@ except:
print('requirements file not found')
with open('course.lp','r') as file:
valid_courses = re.findall('[a-z]+[0-9][0-9V][0-9]{2}',file.read())
with open('main.lp','w') as main:
courses = csvr[2] #list of courses student has taken
taken = '_taken(%s,[' % student
hasTaken = str()
for c in courses:
if not c in valid_courses:
print('Warning: %s is not in course.lp')
#include only those courses that could possibly
#counted as electives in the 'taken list' i.e.
#those that are not required.
This program writes writes <major><year>req2.lp.
Pass in <major> as the first argument and <year> as the second.
Pass in the degree major and year
ex: python req_writer.py bs cs 2015
import re,sys
major = sys.argv[1]
year = sys.argv[2]
if len(sys.argv) != 4:
print("Usage: python req_writer.py <degree> <major> <year>")
(degree, major, year) = sys.argv[1:]
directory = "%s/%s/%s/" % (degree,major,year)
prefix = "%s%s" % (major,year)
with open('course.lp','r') as file:
courses = re.findall('[a-z]+[0-9][0-9V][0-9]{2}',file.read())
with open(degree+'req.lp','r') as file:
with open(directory+prefix+'req.lp','r') as file:
req = file.read()
with open(degree+'req2.lp','w') as file:
with open(directory+prefix+'req2.lp','w') as file:
for c in courses:
if not (c in req):
file.write('_req(%s,none).\n' % c)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment