Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

python programming!! 3.outputwordpointpairs(pointwordlist, filename, tofile) - no return ... Question: IN PYTHON PROGRAMMING!! 3.outputWordPointPairs(pointWordList, filename, toFile) - NO return (just... Edit question IN PYTHON PROGRAMMING!!

python programming!! 3.outputwordpointpairs(pointwordlist, filename, tofile) - no return ... Question: IN PYTHON PROGRAMMING!! 3.outputWordPointPairs(pointWordList, filename, toFile) - NO return (just... Edit question IN PYTHON PROGRAMMING!! 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".

Output when input is "buoni.txt" will be

obi 5

nub 5

nob 5

nib 5

bun 5

bio 5

bin 5

bi 4

uni 3

ion 3

on 2

nu 2

no 2

in 2

u 1

i 1

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

PC Magazine Guide To Client Server Databases

Authors: Joe Salemi

1st Edition

156276070X, 978-1562760700

More Books

Students also viewed these Databases questions

Question

Explain the pages in white the expert taxes

Answered: 1 week ago