Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Olivier
Peer-graded student exercises
Commits
af46ed9a
Commit
af46ed9a
authored
Aug 15, 2019
by
Olivier
Browse files
M2: replace problem with an example (dummy) problem
parent
2caa7aed
Changes
1
Hide whitespace changes
Inline
Side-by-side
M2_customize_assignments/assign_customizer.py
View file @
af46ed9a
...
...
@@ -23,6 +23,22 @@ custom_ID_G = [] # Custom ID of the grading file for the student
rand_matrix
=
[]
# These are the random numbers to customize the assignments
custom_values
=
[]
# Matrix with all custom values for each student assingment
###########################################################################
# Parameters specific to assignment exercise
# Number of assignment
assignment_number
=
"_example"
# Markers for values:
# those are text markers to be replaced by numbers in each student assignment
markers
=
[
'XXlengthXX'
,
'XXwidthXX'
'XXareaXX'
,
'XXarea_doubledXX'
]
###########################################################################
"""-------------------------Hard coded input--------------------------------"""
# Input file paths
assignment_path
=
'script_input/assignment'
+
assignment_number
+
'.tex'
...
...
@@ -67,26 +83,43 @@ for email in emails:
custom_ID_A
.
append
(
ID_A
)
custom_ID_G
.
append
(
ID_G
)
rand_matrix
.
append
(
rand_numbers
)
"""- (HARD CODED) parameters and solutions are specific for this excercise -"""
###########################################################################
# Parameters and solutions are specific for this excercise
# Example exercise for demonstration: calculate area of rectangle given its sides
# Generate custom values for each student from the semi-random numbers
for
i
in
range
(
0
,
len
(
first_names
)):
# Inlet #1 air speed [m/s]
min_speed_in1
=
10
max_speed_in1
=
20
speed_in1
=
min_speed_in1
+
(
max_speed_in1
-
min_speed_in1
)
*
rand_matrix
[
i
][
0
]
speed_in1
=
round
(
speed_in1
)
# round-off decimals = 0
# (code redacted)
# Input values for the side lenghts [m]
min_x
=
10
max_x
=
20
width
=
min_x
+
(
max_x
-
min_x
)
*
rand_matrix
[
i
][
0
]
length
=
min_x
+
(
max_x
-
min_x
)
*
rand_matrix
[
i
][
1
]
# side lengths [m]
width
=
round
(
width
)
# round-off decimals = 0
length
=
round
(
length
)
# round-off decimals = 0
# area of rectangle [m^2]
area
=
width
*
length
# area of rectangle when sides doubled [m^2]
area_doubled
=
area
*
4
###########################################################################
# Store the calculated custom numbers for the assignments
custom_values
.
append
([
speed_in1
,
speed_in2
,
])
"""-------------------------------------------------------------------------"""
custom_values
.
append
([
length
,
width
,
area
,
area_doubled
,
])
###########################################################################
# Store the custom assignment data for all the students in a csv file
with
open
(
output_csv_path
,
'w'
,
newline
=
''
,
encoding
=
"utf-8"
)
as
f
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment