Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions play
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
quizFile = open('Qs.txt',encoding = 'utf-8')
quizQs = [each.strip() for each in quizFile]
outfile = open('prcssdQs.txt', 'wt')
count = 1
questionNumber = 0
columnNum = '5'
multSymbole = ''
print(quizQs)
quizFile.close()
dictOfQs = {}
def questNum():
global count
StrCount = str(count)
if count < 10:
questNum = startQ + "00" + strCount
elif count >= 100:
questNum = startQ + strCount
else:
questNum = startQ + "0" + strCount
count += 1
return questNum
for each in quizQs:
if each[:2] == 'qq':
startQ = each[:2]
dictOfQs[questNum()] = dictOfQs.get(questNum, each)
55 changes: 24 additions & 31 deletions python_for_AMC.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,31 +115,25 @@ def columnNumber(value):
monthInt = int(dateOfTest[4:6])
dayInt = int(dateOfTest[6:])

if yearInt >= 2020:
year = yearInt
else:
print("Wrong date format! Revise the exam year.")
sys.exit()

if monthInt < 13 and monthInt > 0:
month = monthInt - 1
else:
print("Wrong date format! Revise the month.")
sys.exit()

if month in months30 and dayInt < 31:
day = dayInt
day = str(dayInt)
elif month in months31 and dayInt < 32:
day = dayInt
elif month == 1 and year % 4 == 0 and dayInt < 30:
day = dayInt
elif month == 1 and year % 4 != 0 and dayInt < 29:
day = dayInt
day = str(dayInt)
elif month == 1 and yearInt % 4 == 0 and dayInt < 30:
day = str(dayInt)
elif month == 1 and yearInt % 4 != 0 and dayInt < 29:
day = str(dayInt)
else:
print("Wrong date format! Revise the date.")
sys.exit()

dateOfTestM = monthList[month] + " " + str(day) + ", " + str(year)
dateOfTestM = monthList[month] + " " + day + ", " + str(yearInt)

### FIRST PART OF AMC FILE

Expand All @@ -157,16 +151,7 @@ def columnNumber(value):
%%% Starting of the document
\\begin{document}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Student's name part
\\hfill
\\fbox{
\\begin{minipage}{.5\\linewidth}
Firstname and lastname:\\\\
\\vspace*{.1cm}\\dotfill
\\vspace*{1mm}
\\end{minipage}
} % fbox
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%%% Document properties
\\AMCrandomseed{1237893}
\\def\\AMCformQuestion#1{\\vspace{\\AMCformVSpace}\\par{\\bf Q#1:} }
Expand Down Expand Up @@ -245,18 +230,26 @@ def columnNumber(value):
%%% Actual test sheets
\\onecopy{''' + copyNumber + '''}{
%%% Beginning of the test sheet header
%%% Student's name part
\\hfill
\\fbox{
\\begin{minipage}{.5\\linewidth}
Firstname and lastname:\\\\
\\vspace*{.1cm}\\dotfill
\\vspace*{1mm}
\\end{minipage}
} % fbox
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Exam Name
\\begin{flushleft}
{\\bf ''' + examName + '''}
\\end{flushleft}
%%% Exam Date
\\begin{minipage}{.4\\linewidth}
\\bf '''+ dateOfTestM + ''' %date if needed
\\vspace{1ex}
\\begin{minipage}
{\\bf ''' + examName + ''' \\ hfill \\bf '''+ dateOfTestM + '''} %date if needed
\\end{minipage}
\\vspace{1ex}''' + multSymbole + '''
\\vspace{1ex} \\''' + multSymbole + '''
%%% Questions


\\vspace{1ex}
\\
\\insertgroup{general}
\\AMCcleardoublepage
%%% Use either \\clearpage or \\AMCcleardoublepage options. Double page will result in even number of pages for questions, so that you can print out questions double-sided and answer sheets separately
Expand Down