Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cats Fa20 #8

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
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
3 changes: 2 additions & 1 deletion analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@

cats = {
"accuracy": ["def accuracy", "def wpm"],
"autocorrect": ["def autocorrect", "def sphinx_swap"],
"autocorrect": ["def autocorrect", "def shifty_shifts"],
"fastest_words": ["def fastest_words(", "def game"]
}

ants = {
Expand Down
2 changes: 1 addition & 1 deletion finalizing.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ def grade(comments):
else:
score = 0

return score, MESSAGES[score]
return score, MESSAGES[score]
20 changes: 18 additions & 2 deletions templates.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@
"strategy-calls": "Instead of calling `strategy0` (and `strategy1` below) twice, it is "
"better to store the value returned from the function call and use it in both "
"places. This avoids redundant and possibly expensive function calls.",
"who-calls": "`who = other(who)` is used in both the if and the else statement. We can make this code"
"more precise by using is just once after both the if and the else statement.",
"who-calls": "`who = other(who)` is used in both the if and the else statement. We can make this code "
"more precise by using it just once after both the if and the else statement.",
},
"max_scoring_num_rolls": {
"call-make-averaged-in-loop": "Since `roll_dice` and `trials_count` do not change in the iteration, the code can "
Expand Down Expand Up @@ -121,9 +121,18 @@
"accuracy": {
"for-loop-with-range": "Could you use a `for` loop with `range` here, instead of a `while` loop? This removes the "
"need for an extra index variable ",
"great-for": "Great use of a `for` loop here instead of a `while` loop. This removes the need for an extra "
"`index` variable. ",
"nested-return": "The last `return` statement should belong inside the `else` clause.",

"earlier-length-check": "We should check if `len(typed_words) == 0` before attempting to calculate the score as it "
"gives a cleaner flow of logic/makes it obvious that if length is 0, there's no need to "
"do any extra work.",
"recursion-complex": "Using recursion is one of the ways to solve this problem. However, recursion can "
"sometimes make the logic more complex. For this problem, consider using iteration "
"and combining as much of the logic as possible. For example, we could iterate over "
"the `range(min(len(typed_words), len(reference_words)))` and compare each word from "
"`typed_words` with the respective word from `reference_words`.",
"if-instead-of-min": "You can use `min`, rather than a series of `if/elif/else` statements, to compute the desired value.",
"good-min-use": "Nice use of the min function to consolidate code logic of checking lengths into your for loop condition!"
},
Expand All @@ -141,6 +150,13 @@
"good-zip-use": "Great use of the `zip` function!",
"good-dict-use": "Great use of a dictionary to utilize it's `.get` method as the `key` for the `min` function!",
},
"fastest_words": {
"abstraction-barrier": "Make sure you aren't violating the abstraction barrier. You should use the provided selector "
"functions instead.",
"many-loops": "This solution is a bit complex... You shouldn't need more than 3 for loops.",
"good-min-key": "Nice use of the min function with a key! This makes the code not only efficient, but easy to read "
"and understand.",
},
}

ants_templates = {
Expand Down