subject

This program reads a file called 'test. txt'. you are required to write two functions that build a wordlist out of all of the words found in the file and print all of the unique words found in the file. remove punctuations using 'string. punctuation' and 'strip()' before adding words to the wordlist. write a function build_wordlist() that takes a 'file pointer' as an argument and reads the contents, builds the wordlist after removing punctuations, and then returns the wordlist. another function find_unique() will take this wordlist as a parameter and return another wordlist comprising of all unique words found in the wordlist. example: contents of 'test. txt': test fileanother line in the test fileoutput: ['another', 'file', 'in', 'line', 'test', 'the']this the skeleton for 1: #build_wordlist() function goes here#find_unique() function goes heredef main(): infile = open("test. txt", 'r')word_list = build_wordlist(infile) new_wordlist = find_unique(word_list)new_wordlist. sort()print(new_wordlist)main()2-wr ite a function called 'game_of_eights()' that accepts a list of numbers as an argument and then returns 'true' if two consecutive eights are found in the list. for example: [2,3,8,8,9] -> true. the main() function will accept a list of numbers separated by commas from the user and send it to the game_of_eights() function. within the game_of_eights() function, you will provide logic such that: the function returns true if consecutive eights (8) are found in the list; returns false otherwise. the function can handle the edge case where the last element of the list is an 8 without crashing. the function prints out an error message saying 'error. enter only integers.' if the list is found to contain any non-numeric characters. note that it only prints the error message in such cases, not 'true' or 'false'.examples: enter elements of list separated by commas: 2,3,8,8,5trueenter elements of list separated by commas: 3,4,5,8falseenter elements of list separated by commas: 2,3,5,8,8,uerror. enter only integers. hint: you will need to use try-except to catch exceptions. this is the skeleton for 2: #game_of_eights() function goes heredef main(): a_list = input("enter elements of list separated by commas: ").split(',')result = game_of_eights(a_list)main()

ansver
Answers: 1

Another question on Computers and Technology

question
Computers and Technology, 23.06.2019 01:30
How do you set up a slide show to play continuously, advancing through all the slides without requiring your interaction? a. click set up slide show, and then select the loop continuously until ‘esc' and show without narration options. b. click set up slide show, and then select the loop continuously until ‘esc' and use timings, if present options. c. click set up slide show, and then select the show presenter view and use timings, if present options. d. click set up slide show, and then select the show without animation and browsed at a kiosk (full screen) options.
Answers: 3
question
Computers and Technology, 24.06.2019 05:30
Why is hard disk space important to an audio engineer? why are usb ports and firewire ports useful for an audio engineer? explain in 2-3 sentences. (3.0 points) here's a list of different audio software: ableton live apple inc.'s garageband apple inc.'s logic studio digidesign's pro tools propellerhead sofware's reason sony creative software's acid pro steinberg cubase steinberg nuendo choose one of the software programs listed above, and then go to that software program's web site. read about what the software program is used for, and then write 4-5 sentences about what you learned. (10.0 points) which type of software license is the most limiting? why? explain in 2-3 sentences. (3.0 points) when sending a midi channel voice message, how can you control the volume of the sound? explain in 2-3 sentences. (4.0 points)
Answers: 1
question
Computers and Technology, 24.06.2019 21:40
Clunker motors inc. is recalling all vehicles in its extravagant line from model years 1999—2002 as well as all vehicles in its guzzler line from model years 2004—2007. a boolean variable named recalled has been declared. given a variable modelyear and a string modelname, write a statement that assigns true to recalled if the values of modelyear and modelname match the recall details and assigns false otherwise.
Answers: 2
question
Computers and Technology, 24.06.2019 22:00
True or false technology is often discovered by accident
Answers: 2
You know the right answer?
This program reads a file called 'test. txt'. you are required to write two functions that build a w...
Questions
question
Mathematics, 28.10.2020 20:40