Assignment
Assignment
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
What is the process by which search engines retrieve webpages and build a search index
called?
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
What does the following block of code do with respect to the image 'image.jpg'
import requests
img = requests.get('http://data.pr4e.org/cover.jpg').content
fhand = open('cover.jpg', 'wb')
fhand.write(img)
fhand.close()
Choose the correct answer from below:
Display that particular image from corresponding URL
Retrieves image and saves it locally
Downloads the image and shows the output.
Opens the image as pop-up in the notebook without downloading.
Submit
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
How does one parse the HTML into a BeautifulSoup object given a response object from
request.get()?
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
import requests
from bs4 import BeautifulSoup
url =
"https://d2beiqkhq929f0.cloudfront.net/public_assets/assets/0
00/000/803/original/Value_of_cost.html?1637754792"
res = requests.get(url)
soup = BeautifulSoup(res.content, 'html.parser')
nm = soup.find_all("span", attrs = {"class": "___?___"})[0]
print(nm.text)
Which is the correct value or string to put in place of the ____?_____ so that the code
prints the name of customer who gave the review i.e. "tarun teja sanapala"?
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
What would be the type of bookshelf which is obtained after scrapping contents of 'li'
tag from "https://books.toscrape.com/"?
page_html = "https://books.toscrape.com/"
res = requests.get(page_html)
page_soup = BeautifulSoup(res.content, "html.parser")
bookshelf = page_soup.find_all("li", {"class": "col-xs-6 col-
sm-4 col-md-3 col-lg-3"})
Choose the correct answer from below:
A container with all the elements with mentioned tag and class.
Pointer to contents of all 'li' tags
Dictionary of each 'li' tag with their content
Dictionary of each tag inside 'li' tag with their content
Submit
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
The Web API returns which of the following status code on successful execution of a GET
request - when the resource has been fetched?
Stuck somewhere?
Ask for help from a TA and get it resolved.
Get help from TA.
After scraping the URL, submit a CSV consisting of the details of the books present on
the link. The details of the books are expected to include the following data fields:
This link consists of the sample submission file, but the number of rows and data in this
file doesn't refer to the actual number of books and actual data on the URL. The purpose
of the Sample CSV is just to show the format and columns.
Note:
1. Make sure that the submitted CSV shouldn't have index column.
2. The name of the data fields should be exactly what is mentioned above.
Submission
Submissions left for today: 3
Restart Submission
1
Upload Code
2
Upload Project Files
3
Upload Output file
1. Upload Code File
Upload Code
(only .py or .r files are accepted)
Select Language
Python (Python-2.7)
Instructions
You are allowed to make maximum of 20 submissions per day. The system will reject
any further submission.
The last submission will be considered final and will be used for your evaluation.
Please follow the output format as specified in the section.