-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Michael Dayan
committed
Nov 19, 2022
1 parent
2bfa04e
commit 0bdb1e5
Showing
9 changed files
with
1,405 additions
and
9 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
import grading | ||
|
||
student_results = { | ||
'John': 3, | ||
'Mary': 9, | ||
'Peter': 5 | ||
} | ||
|
||
if __name__ == "__main__": | ||
print(__name__) | ||
for s_name, s_grade in student_results.items(): | ||
s_feedback = grading.comment_grade(s_grade, mode='negative_reinforcement') | ||
print(f'Feedback for {s_name}: {s_feedback}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def comment_grade(grade: int, mode: str = 'normal') -> str : | ||
''' Provide a feedbac k according to the grade value | ||
Parameters | ||
---------- | ||
grade | ||
The amount of distance traveled | ||
mode | ||
The feedback mode, either "normal" (default) or "positive_reinforcement" | ||
Returns | ||
------- | ||
comment | ||
The grade feedback | ||
Examples | ||
-------- | ||
>>> comment_grade(5) | ||
'Grade high enough' | ||
''' | ||
if grade < 5: | ||
return('Grade too low') | ||
elif grade > 5: | ||
if mode == 'normal': | ||
return('Grade high enough') | ||
elif mode == 'positive_reinforcement': | ||
return('Well done, keep going!') | ||
else: | ||
raise ValueError('The mode should be "normal" or "positive_reinforcement"') | ||
|
||
def test_comments(): | ||
assert comment_grade(0, mode='normal') == 'Grade too low' | ||
assert comment_grade(2, mode='normal') == 'Grade too low' | ||
#assert comment_grade(5, mode='normal') == 'Grade high enough' | ||
#assert comment_grade(5, mode='positive_reinforcement') == 'Well done, keep going!' | ||
assert comment_grade(10, mode='normal') == 'Grade high enough' | ||
assert comment_grade(10, mode='positive_reinforcement') == 'Well done, keep going!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import grading | ||
|
||
student_results = { | ||
'John': 3, | ||
'Mary': 9, | ||
'Peter': 5 | ||
} | ||
|
||
for s_name, s_grade in student_results.items(): | ||
s_feedback = grading.comment_grade(s_grade, mode='negative_reinforcement') | ||
print(f'Feedback for {s_name}: {s_feedback}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
def comment_grade(grade: int, mode: str = 'normal') -> str : | ||
''' Provide a feedbac k according to the grade value | ||
Parameters | ||
---------- | ||
grade | ||
The amount of distance traveled | ||
mode | ||
The feedback mode, either "normal" (default) or "positive_reinforcement" | ||
Returns | ||
------- | ||
comment | ||
The grade feedback | ||
''' | ||
if grade < 5: | ||
return('Grade too low') | ||
elif grade > 5: | ||
if mode == 'normal': | ||
return('Grade high enough') | ||
elif mode == 'positive_reinforcement': | ||
return('Well done, keep going!') | ||
else: | ||
raise ValueError('The mode should be "normal" or "positive_reinforcement"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import grading | ||
|
||
student_results = { | ||
'John': 3, | ||
'Mary': 9, | ||
'Peter': 5 | ||
} | ||
|
||
for s_name, s_grade in student_results.items(): | ||
s_feedback = grading.comment_grade(s_grade, mode='negative_reinforcement') | ||
print(f'Feedback for {s_name}: {s_feedback}') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
def comment_grade(grade: int, mode: str = 'normal') -> str : | ||
''' Provide a feedbac k according to the grade value | ||
Parameters | ||
---------- | ||
grade | ||
The amount of distance traveled | ||
mode | ||
The feedback mode, either "normal" (default) or "positive_reinforcement" | ||
Returns | ||
------- | ||
comment | ||
The grade feedback | ||
''' | ||
if grade < 5: | ||
return('Grade too low') | ||
elif grade >= 5: | ||
if mode == 'normal': | ||
return('Grade high enough') | ||
elif mode == 'positive_reinforcement': | ||
return('Well done, keep going!') | ||
else: | ||
raise ValueError('The mode should be "normal" or "positive_reinforcement"') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
def comment_grade(grade: int, mode: str = 'normal') -> str : | ||
''' Provide a feedbac k according to the grade value | ||
Parameters | ||
---------- | ||
grade | ||
The amount of distance traveled | ||
mode | ||
The feedback mode, either "normal" (default) or "positive_reinforcement" | ||
Returns | ||
------- | ||
comment | ||
The grade feedback | ||
''' | ||
if grade < 5: | ||
return('Grade too low') | ||
elif grade > 5: | ||
if mode == 'normal': | ||
return('Grade high enough') | ||
elif mode == 'positive_reinforcement': | ||
return('Well done, keep going!') | ||
else: | ||
raise ValueError('The mode should be "normal" or "positive_reinforcement"') | ||
|
||
def test_comments(): | ||
assert comment_grade(0, mode='normal') == 'Grade too low' | ||
assert comment_grade(2, mode='normal') == 'Grade too low' | ||
assert comment_grade(5, mode='normal') == 'Grade high enough' | ||
assert comment_grade(5, mode='positive_reinforcement') == 'Well done, keep going!' | ||
assert comment_grade(10, mode='normal') == 'Grade high enough' | ||
assert comment_grade(10, mode='positive_reinforcement') == 'Well done, keep going!' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
def comment_grade(grade: int, mode: str = 'normal') -> str : | ||
''' Provide a feedbac k according to the grade value | ||
Parameters | ||
---------- | ||
grade | ||
The amount of distance traveled | ||
mode | ||
The feedback mode, either "normal" (default) or "positive_reinforcement" | ||
Returns | ||
------- | ||
comment | ||
The grade feedback | ||
Examples | ||
-------- | ||
>>> comment_grade(5) | ||
'Grade high enough!' | ||
''' | ||
if grade < 5: | ||
return('Grade too low') | ||
elif grade >= 5: | ||
if mode == 'normal': | ||
return('Grade high enough') | ||
elif mode == 'positive_reinforcement': | ||
return('Well done, keep going!') | ||
else: | ||
raise ValueError('The mode should be "normal" or "positive_reinforcement"') | ||
|
||
def test_comments(): | ||
assert comment_grade(0, mode='normal') == 'Grade too low' | ||
assert comment_grade(2, mode='normal') == 'Grade too low' | ||
assert comment_grade(5, mode='normal') == 'Grade high enough' | ||
assert comment_grade(5, mode='positive_reinforcement') == 'Well done, keep going!' | ||
assert comment_grade(10, mode='normal') == 'Grade high enough' | ||
assert comment_grade(10, mode='positive_reinforcement') == 'Well done, keep going!' |