(Solved) : Sharp Need Help Figure Python3 Assignment Assignment Provide Two Files Assignment One Samp Q42690876 . . .

IN SHARP NEED OF HELP TO FIGURE OUT THIS PYTHON3 ASSIGNMENT:

HERE IS THE ASSIGNMENT ITSELF:

We provide two files for this assignment. One is a sample filewhere we give you the sum for your testing and the other is theactual data you need to process for the assignment.

  • Sample data: http://py4e-data.dr-chuck.net/comments_42.html(Sum=2553)
  • Actual data: http://py4e-data.dr-chuck.net/comments_328383.html(Sum ends with 25)

You do not need to save these files to your folder since yourprogram will read the data directly from the URL.Note: Each student will have a distinct data urlfor the assignment – so only use your own data url foranalysis.

Data Format

The file is a table of names and comment counts. You can ignoremost of the data in the file except for lines like thefollowing:

<tr><td>Modu</td><td><span class=”comments”>90</span></td></tr><tr><td>Kenzie</td><td><span class=”comments”>88</span></td></tr><tr><td>Hubert</td><td><span class=”comments”>87</span></td></tr>

You are to find all the <span> tags in the file and pullout the numbers from the tag and sum the numbers.

Look at the sample code provided. It shows how to find all of acertain kind of tag, loop through the tags and extract the variousaspects of the tags.

…# Retrieve all of the anchor tagstags = soup(‘a’)for tag in tags: # Look at the parts of a tag print ‘TAG:’,tag print ‘URL:’,tag.get(‘href’, None) print ‘Contents:’,tag.contents[0] print ‘Attrs:’,tag.attrs

You need to adjust this code to look for spantags and pull out the text content of the span tag, convert them tointegers and add them up to complete the assignment.

Sample Execution

$ python3 solution.pyEnter – http://py4e-data.dr-chuck.net/comments_42.htmlCount 50Sum 2…

Turning in the Assignment

Enter the sum from the actual data and your Python codebelow:
Sum:  (ends with 25)

Expert Answer


Answer to IN SHARP NEED OF HELP TO FIGURE OUT THIS PYTHON3 ASSIGNMENT: HERE IS THE ASSIGNMENT ITSELF: We provide two files for thi…

Leave a Comment

About

We are the best freelance writing portal. Looking for online writing, editing or proofreading jobs? We have plenty of writing assignments to handle.

Quick Links

Browse Solutions

Place Order

About Us