Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

hello, need some help on python . please use basic package. have no clue how to start ... here so here is instruction 2. canWeMakelt(myWord,

hello, need some help on python . please use basic package. have no clue how to start ...

here so here is instruction

image text in transcribed

image text in transcribed

2. canWeMakelt(myWord, myLetters) return True or False. Write a function which answers the question: Can I form the word myword from the string of letters myLetters? The function should return a boolean True or False. Converting myLetters to a list and using the pop0 or remove0 method may come in handy You do not need to use all the letters in myLetters. It's possible that myLetters will contain multiples of the same letters. In the example above if myLetters "buoni.. and myword- "boon.. it should return False. If the input is not the correct type then return False Try to write an algorithm on paper first before attempting to write the code. Think about the list functions at your disposal and the tools you've learned up till now 3. getWordPoints(myWord, letterPoints) - return an int representing the points for myWord. Write a function that calculates and returns the total point value of myWord given the Python dictionary object letterPoints which consists of letter:pointValue pairs. If a character in myword is not a key in the provided dictionary then its score value is O. If any of the input is incorrect type then return 0. Note that you do not need to create the letterPoints dictionary in this step - it is a parameter to our function and will be created in scrabbleWords() def, getWordPoints (myWord, letterPoints) Returns the total points of a given word. param myWord the string you want to calculate points for param LetterPoints: a dictionary of (letter, value) pairs which gives the point vlue of each letter return The total point value of the word. return "stub def outputWordPointPairs (pointWordList, filename, toFile) Outputs the contents of pointWordList in a specified format to a file (see lab instructions) param pointWordList: a list of tuples to print or output to a file, each tuple contains a (pointValue, word) pair param filename: a string that you will name the file with if toFile is True Your function should add the .txt extension to the filename before creating it param toFile: a boolean to decide whether I want to print to file or not. If True then output to file else output to terminal return None return

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions