Whileecoyote37 / pwp-capstones

0 stars 0 forks source link

Murder Mystery (PWP) #1

Open asadmehdi785 opened 6 years ago

asadmehdi785 commented 6 years ago

Criteria 1: Valid Python Code

Criteria 2: Implementation of Project Requirements

Criteria 3: Software Architecture

Criteria 4: Uses Python Language Features

Criteria 5: Produces Accurate Output

Overall Score: 19/20

Overall, excellent work with this project! You did a great job in all aspects of the project, from implementing the project requirements to using Python specific features when applicable. Good job with that!

I just wanted to point you to a string processing module that's included with Python that may be useful for certain aspects of this project, especially with the prepare_text method. There is a module called re that allows you to do regular expression operations in Python. With this module, we can actually complete what is done in the following function:

def prepare_text(text):
    all_letters = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z']
    result = ""
    for man in text:
        if man in all_letters or man == " ":
            result += man.lower()
    return result.split()

With a single line of code instead. You can look at this resource for more information about that (you can look at the accepted answer).

I also just want to mention that I really liked how you wrote this function:

def build_frequency_table(corpus):
    word_list = []
    ammount_list = []
    for y in corpus:
        ammount_list.append(corpus.count(y))
    result = {key:value for key, value in zip(corpus, ammount_list)}
    return result

You made good use of zip and dictionary comprehension here. Well done!

Great job overall! I hope you enjoyed the course!

Whileecoyote37 commented 6 years ago

Thank you for the comments and overall score. This project did take some time/work on my part. As for using the "re" function, that is something i've never heard of. From now on, it would make sense to use it rather than the function I made. But from my point of view at the time, it was a lot more work to search for a pre-made function, understand the ins and outs of it and implement it rather than just making my own. My way took maybe 5 minutes to do. I did have one issue/grievance about this project. The margin of guilt that Gregg was higher than Lily was very small. In my opinion, that wouldn't be enough to call one the murderer and the other innocent. And depending on how you wrote the functions, how you split up the samples, and what exactly you are analyzing, you could get a different result. Do you know what the scores would be the Codecademy way of writing the program?