Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. outputWordPointPairs(pointWordList, filename, toFile) - NO return (just prints a formatted list or writes it to file). NOTE: Your function should add the .txt extension

3. outputWordPointPairs(pointWordList, filename, toFile) - NO return (just prints a formatted list or writes it to file). NOTE: Your function should add the .txt extension to the filename before opening a file with that name. Write a function which will output the (pointValue, word) pairs in pointWordList to the shell or to a file depending on the bool value toFile. Note the order of elements of the tuple is (pointValue, word) not (word, pointValue). Find out why this specific order is preferred. When toFile is False, print all the words followed by their point value. Format the output so that your word is left justified in a field of width 4 more than the number of letters in filename, and the point value follows immediately afterwards. You can do this with the format string method by carefully forming the '{...}' string first. If toFile is True, write the same text as your formatted screen output from above to a text file. Name the file the string of letters contained in myLetters followed by .txt. So in the example above with scrabbleWords(buoni), the file that is created is buoni.txt. Note that every time you want to write to a new line, you will need to include the newline character in your file.write() statement. You can see what the output should look like in the example here: buoni.txt. You can simply verify that when you run your program you produce this same file if myletters == "buoni". Python Programming

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_2

Step: 3

blur-text-image_3

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

Datacasting How To Stream Databases Over The Internet

Authors: Jessica Keyes

1st Edition

007034678X, 978-0070346789

More Books

Students also viewed these Databases questions

Question

Why would a business use an agent to act on its behalf?

Answered: 1 week ago