Exam1Sol_001 - Exam 1 Solution CIS4930 NLP February 1, 2010...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
Exam 1 Solution – CIS4930 NLP – February 1, 2010 1.[5 pts] Define and describe what self means within a Python class. This is the extra parameter at the beginning of the parameter list of any class method; it does not need to be specified in the method call but is supplied automatically by Python. It refers to the current instance of the class. It is not required that this parameter be named self – that is just a widespread (highly recommended) convention. 2. [10 pts] Create the python class Tag. This class will include a string property name, the name of the tag. #It is not necessary to supply an init method, but for clarity, one has been provided here class Tag: def __init__(self, name): self.name = name 3. [15 pts] Create the Python class HTML Tag, a subclass to TAG. The class will contain a dictionary called attributes. The keys in the dictionary will be the attribute name. The corresponding value to each key will be the value of the attribute. In addition to the class structure, provide methods: search and update . Search will return the value of a
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 3

Exam1Sol_001 - Exam 1 Solution CIS4930 NLP February 1, 2010...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online