CSC 242: Introduction to Computer Science II Assignment 9 Due Thursday, June 18th, 11:59 pm Reading Review Chapter 10 and read Chapter 11 in Introduction to Computing using Python: An Application...

1 answer below »
Please do what is asked for recursion do not use loop , only recursion


CSC 242: Introduction to Computer Science II Assignment 9 Due Thursday, June 18th, 11:59 pm Reading Review Chapter 10 and read Chapter 11 in Introduction to Computing using Python: An Application Development Focus, Second Edition by Ljubomir Perković. Logistics In this class programming assignments may be completed in consultation with up to two other classmates. You must identify the classmates with whom you collaborate in a comment at the top of the assignment, and the number of collaborators on any assignment may not exceed two other people. You must also submit a comment in your submission for each assignment that describes in detail how each collaborator contributed to the assignment. If you did not collaborate with anyone on the assignment, you must include a comment that says that. You may not under any circumstances discuss the assignments with classmates other than your identified collaborators. Working so closely with anyone other than your identified collaborators, Mr. Zoko or the teaching assistant, so as to produce identical or near identical code is a violation of the Academic Integrity policy. This policy will be strictly enforced. Please include the following with your assignment submission: 1. A comment at the top of your Python file identifying any classmates with whom you discussed or in any other way collaborated on the assignment. You may work (directly or indirectly) with no more than two other people. 2. Add a comment at the top of your Python file that describes for each person what they contributed to the assignment. This must be at least 2-3 sentences and be very specific and detailed. A submission that does not include a list of collaborators and comments indicating how you collaborated with classmates will earn a 0. If you worked alone you must put a comment at the top of your file that indicates that or you will also receive a 0. There will be no exceptions to this rule. Again, you are subject to all the rules specified in the Academic Integrity policy. Please read it carefully before beginning this assignment. Assignment Please remember that you are not allowed to consult online resources when completing homework assignments. If you have questions about this assignment, please contact me. Implement the functions below in a file called csc242hw9.py a template for which has been provided on the D2L site. You must include appropriate doc strings (e.g. strings that appear on the line following the function header) to the class that clearly and concisely describe what the functions are doing. A submission without doc strings will not earn full credit. The functions written for this assignment must be recursive and must not use global variables. Do not modify the function names or parameters in the template file. Each function will use a loop, but the main work of the function will be done using recursion. Please read the problem description carefully. Function that are described as returning values should not do any printing. Solutions that do not follow these guidelines will not earn full credit, even if they produce the correct results in all cases. Please note that local variables (not global) are absolutely fine in any of the functions. 1: Develop a GUI game that implements a number guessing game. When started, a secret random number between 0 and 9 is chosen. The user is then requested to enter number guesses. Your GUI should have an Entry widget for the user to type the number guess and a Button widget to enter the guess. You must use Grid formatting. A label at the top shows how many guesses you’ve taken in the current game and how many games you’ve played. The game should automatically restart after each round. 3 bad guesses were made: The 4th guess was correct, the number 4: The game resets but the completed count increases. 2. Implement a recursive function dirsWithFiles() that takes as parameters the name of a directory. The function should return a list containing the full pathname of all occurrences of directories that contains files (containing only directories doesn’t count). Please note that your function must work as described on any directory structure, not just the one provided as an example. The following illustrates a sample set of directories located in the zip file containing the assignment template. 3. Implement a recursive function fileContents () that takes as parameters the name of a folder. The function will return a string representing the contents of all the files in the directory hierarchy. Please note that your function must work as described on any directory structure, not just the one provided as an example. You must use recursion to go through the subfolders. You may not use python crawlers or apis other than the ones used in the antivirus-redux example to find files in sub directories. Doing so will be an automatic 0 for this problem. You may use a for loop to loop through the contents of a folder. The following illustrates a sample set of folders and directories located in the zip file containing the exam template. You don’t need to worry about punctuation, case or file error handling for this problem. print(fileContents('Test')) 4. Write a custom parser named ListParser. It will find any list element and print of the values to the screen. Note. You should remove any blank list items. 5. Write a HTMLParser that extracts all the Majors and Degrees from the CDM web site. https://www.cdm.depaul.edu/academics/Pages/Majors-and-Degrees.aspx. Here is an example of the html that the parser will be concerned with: You will see the values in the first column on the page: https://www.cdm.depaul.edu/academics/Pages/Majors-and-Degrees.aspx Submitting the assignment You must submit the assignment using the assignment 9 dropbox on the D2L site. Submit a Python file (csc242hw9.py) with your implementation in it and comments describing your collaboration status. Submissions after the deadline listed above will be automatically rejected by the system. See the syllabus for the grading policy. Grading The assignment is worth 100 points. Each question is worth 20 points Any student who does not submit comments in the Python file describing the contributions of each team member or indicating that he/she worked alone will earn a 0 on the assignment. http://d2l.depaul.edu/ import os from tkinter import Label, Tk, Entry, Button, END from tkinter.messagebox import showinfo from random import randrange class GuessingGame(Tk): def __init__(self,parent=None): 'constructor' Tk.__init__(self, parent) pass def make_widgets(self): pass def updateLabel(self): pass def new_game(self): pass def checkNumber(self): pass def dirsWithFiles(root): pass def fileContents(root): pass from html.parser import HTMLParser from urllib.parse import urljoin from urllib.request import urlopen def testLParser(url): content = urlopen(url).read().decode() parser = ListParser() parser.feed(content) return parser.getListItems() class ListParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) pass def handle_starttag(self, tag, attrs): ipas def handle_endtag(self, tag): pass def handle_data(self, data): pass def getListItems(self): pass from html.parser import HTMLParser from urllib.parse import urljoin from urllib.request import Request, urlopen #'https://www.cdm.depaul.edu/academics/Pages/Majors-and-Degrees.aspx' import ssl def testDegreeOfferParser(url): ctx = ssl.create_default_context() ctx.check_hostname = False ctx.verify_mode = ssl.CERT_NONE req = Request(url) req.add_header('User-agent','Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/82.0.4056.0 Safari/537.36 Edg/82.0.432.3') content = urlopen(req, context=ctx).read() content=str(content) parser = DegreeOfferParser() parser.feed(content) return parser.getPrograms() class DegreeOfferParser(HTMLParser): def __init__(self): HTMLParser.__init__(self) spass def handle_starttag(self, tag, attrs): pass def handle_endtag(self, tag): pass def handle_data(self, data): pass def getPrograms(self): pass print(dirsWithFiles('Test')) print(fileContents('Test')) print(testLParser('http://zoko.cdm.depaul.edu/csc242/lists.html')) print(testDegreeOfferParser('https://www.cdm.depaul.edu/academics/Pages/Majors-and-Degrees.aspx')) from tkinter import Button, Label,Tk,Text,INSERT,TOP,LEFT,RIGHT,END,filedialog, Scale, HORIZONTAL from tkinter.messagebox import showinfo #Put problem 1 here. def stringWithVowelCount(lst): pass print(stringWithVowelCount([])) print(stringWithVowelCount([[1,'Test',2.0,'v','other',1,2,'bbbbb',8,9,10]])) print(stringWithVowelCount([[[[[[[[['nnnnnnnnn']]]]]]]]])) print(stringWithVowelCount([[1,'Anthony',2,3],[4,[[[5,[[[6,'Bob']]]]]]]])) print(stringWithVowelCount([[[[[[[[[10,20],'Carl']]]]]]]])) print(stringWithVowelCount([[[[[[[[[]]]]]]]]])) import os def dirPrint(pathname, indent): '''recursively scans all files contained, directly or indirectly, in the folder pathname''' pass #dirPrint('count',4) #dirPrint('Test',6) def frequency(pathname, word,count): pass print('FREQUENCY: \n', frequency('Test','assign',1)) print('FREQUENCY: \n', frequency('Test-2','e',2)) print('FREQUENCY: \n', frequency('Test','e',2)) print('FREQUENCY: \n', frequency('Test-2','Zoko',1)) print('FREQUENCY: \n',
Answered 2 days AfterNov 10, 2021

Answer To: CSC 242: Introduction to Computer Science II Assignment 9 Due Thursday, June 18th, 11:59 pm Reading...

Shubham Kumar answered on Nov 12 2021
124 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here