Skip to content

Maple - Monica and Mariama#37

Open
mcatcruz wants to merge 16 commits intoAda-C16:masterfrom
mcatcruz:master
Open

Maple - Monica and Mariama#37
mcatcruz wants to merge 16 commits intoAda-C16:masterfrom
mcatcruz:master

Conversation

@mcatcruz
Copy link
Copy Markdown

No description provided.

Comment thread adagrams/game.py

letters_list=[]
import random
letters_dict = {'A' : 9, 'N' : 6, 'B' : 2, 'O' : 8,
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest moving your letters_dict outside of your function and created a global constant variable. It just keeps your function clean and creates better readability.

Comment thread adagrams/game.py


# Wave 2
def available_letters_quantity(letter_bank):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great use of a frequency map here

Comment thread adagrams/game.py
Output:
boolean, True or False
'''
letter_bank_dict = available_letters_quantity(letter_bank)
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great use of a helper function !

Comment thread adagrams/game.py
Output:
sum, an integer; example: sum = 29
'''
letter_dict={1:['A', 'E', 'I', 'O', 'U', 'L', 'N', 'R', 'S', 'T'], 2:['D','G'],3:['B', 'C', 'M', 'P' ],4:['F', 'H','V', 'W', 'Y'],5:['K'],8:['J','X'],10:['Q','Z']}
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same suggestion above to make this a constant global variable

Comment thread adagrams/game.py
words_and_scores_dict[word_list[i]] = {"score": score_word(word_list[i]), "word_list_index": i, "word_length": len(word_list[i])}
return words_and_scores_dict

def get_highest_word_score(word_list):
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great use of a helper function and compound conditionals here

@tgoslee
Copy link
Copy Markdown

tgoslee commented Oct 5, 2021

Great work!! I loved the use of helper functions and the use of your dictionaries! I left a comment on refactoring and how you approach some of the functions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants