ericseliasson / CodeAcademyPythonCapstone

Code Academy Python Capstone
0 stars 0 forks source link

Project Review #1

Open jordanwillis opened 6 years ago

jordanwillis commented 6 years ago

Rubric Score

Criteria 1: Valid Python Code

Criteria 2: Implementation of Project Requirements

  1. get_average_sentence_length should return the average number of words per sentence instead of the average number of characters per sentence (which is what your implementation is calculating). The main different is that for each sentence you should split into individual words, then store the number of words in each sentence. Here is an example of the correct implementation.
def get_average_sentence_length(text):
    no_questions = text.replace('?', '.')
    no_exclaim = no_questions.replace('!', '.')
    sentences = list(filter(None, no_exclaim.split('.')))
    sentence_lengths = []
    for sentence in sentences:
        words = sentence.split()
        sentence_lengths.append(len(words))

    average = sum(sentence_lengths) / len(sentences)
    return average

One other thing to note is that split('.') returns a list with an empty last index because the final sentence ends with a period. So in order to get the correct result we need to ensure that this is filtered out. Lastly, don't forget that sentences can often end with other valid characters such as ? and !. So be sure to replace these with a period in order to not skew the results.

Be sure to checkout the below review section (Criteria 4) for some recommendations and feedback on how you might further improve your Python skills

Criteria 3: Software Architecture

Criteria 4: Uses Python Language Features

  1. I would recommend always using triple quotes for long strings. They offer more safety and flexibility in that they allow for multi-line strings.

  2. Great job on your prepare_text and build_frequency_table implementations! I loved your efficient use of built in functions and language features. Very nicely done!!

Criteria 5: Produces Accurate Output

Overall Score: 19/20

Overall you did a fantastic job on this project! I can tell that you have learned a lot from the PWP course and hope you continue on with your Python journey.

Keep up the great work!

ericseliasson commented 6 years ago

Thanks Jordan, this was really helpful feedback!