Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Python Question (2.7) Please use recommendation module. The dictionary should be

ID: 666129 • Letter: P

Question

Python Question (2.7)

Please use recommendation module. The dictionary should be created by reading the file

Data set is Webscope_R5.tgz. :

https://drive.google.com/folderview?id=0Bz_aB61VIRZAfnNoamZmZVdVR19TNmdmVDBwbk5aN1JsNkQyNTVRLUgwVVB2elVIUHBfcFE&usp=sharing

PROBLEM DESCRIPTION delicious (formerly, del.icio.us) is a web site that allows users to save their favorite links (bookmarks) online. Each link has also one or more "tag"'s that represent the categories or topics of the website, Su 1. Using the provided dataset (described below), first create a dictionary of tags and items (i.e., web links). That is, you will create a dictionary which will be very similar to critics dictionary where the key will be a URL, and value will be another dictionary in which key will be a tag and value will be how many times that URL is tagged with that tag

Explanation / Answer

###
# To add an item to a dictionary, assign a value to a new key.
###

# Create an empty dictionary.
d = {}

# Add a new item.
d['key1'] = 'value1'

# You may also use different types other than strings for key/value pairs.
# Assigns an integer value to the 'key2' key.
d['key2'] = 1234567890

# Assigns a list value to the 'key3' key.
d['key3'] = ['a', 'b', 'c']

# Assigns a tuple value to the 'key4' key.
d['key4'] = (1, 2, 3)

# Even the key can be a type other than strings.
# The key here is an float.
d[98.6] = 'temperature'

# Prints the contents of the dictionary.
print 'd = ', d