![]() outputWordPointPairs(pointWordList, myLetters, toFile) - NO return (just prints a formatted list or writes it to a file).getWordPoints(myWord, letterPoints) - return an integer representing the point value for a word.canWeMakeIt(myWord, myLetters) - return True or False.createWordList(filename) - return a list of strings.Use the starter code we have provided at the end of the lab. Note that you can also open the file in a new tab/window and copy/paste its contents into a new “wordlist.txt” file in your directory. This file must be downloaded (right click and “save as”) and put into your lab05 directory before you begin, so do that now. So, how did our program know which letter combinations were valid words?……We have to specify a file of words, which you can find here: wordlist.txt. The section “Putting it all together” describes what scrabbleWords() method is supposed to do and how to call the helper functions, so if you want to see the big picture, start reading the section “Putting it all together” first. You will first define four helper functions, which you will then use in the main scrabbleWords() method. ![]() For example, if I input 'bouni' as my string of letters, this is what I get: In the end, you will input a string of letters and your program will print out (to the screen and to a file) a list of all possible words you can make along with their point values in descending order (neglecting things like triple letter, double word squares, etc. In this lab assignment, you are going to make your own Scrabble word finder function, scrabbleWords(). The words that players create earn points by counting the points for the letters according to the game rules. Scrabble is a word game in which players take turns placing tiles with individual letters onto a game board. When you have the IDLE window up, you are ready for some programming! The terminal command for this is “ idle3 &”. Step 2: Create a directory in your cs8 directory named lab05.This is done following the steps you have performed in lab00. Step 1: Log on and open up a terminal window.Make sure that you adhere to the Academic Integrity standards and do/submit your own work. formatting output and writing it to the screen and a file.using list method sort() to sort words in order of descending point value.reading data (words) from a text file and putting them into a list.In this lab, you’ll get more practice with: Scrabble Word Finder: Python lists, dictionaries and file I/O Lab05 : Scrabble Word Finder: Python lists, dictionaries and file I/O num
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |