CP164 Study Guide - Final Guide: Alex Proyas, Data Element, Binary Search Algorithm

54 views2 pages
School
Course
Professor
def write(self, fv):
"""
-------------------------------------------------------
Writes a single line of movie data to an open file fv
in the format
title|year|director|rating|code
Use: movie.write(fv)
-------------------------------------------------------
Parameters:
fv - an already open file of movie data (file)
Returns:
None
-------------------------------------------------------
"""
# Your code here
The only way to create a Movie object is to call the Movie constructor and pass it the proper
parameters. The following string contains movie data:
Dark City,1998,Alex Proyas,7.8,0
but this string is not a Movie object.
If, however, we call the Movie constructor and pass it this same data:
from Movie import Movie
some_movie = Movie('Dark City', 1998, 'Alex Proyas', 7.8, [0])
then the variable some_movie is a Movie object, because it was created by calling the Movie
constructor.
- Data Structure ADTs
The data storage classes we have seen so far, such as Student and Food, are designed to
hold a single piece of data. That data may have many attributes and methods, both those
attributes and methods taken together are still designed to worth with a single data
element. A data structure ADT is designed to hold multiple pieces of data, whether simple
values such as integers or strings, or more complex objects such as as Students or Foods.
A data structure ADT must have the following properties:
it must be initialized before it can be used
an instance of an ADT should work with one type of data only
find more resources at oneclass.com
find more resources at oneclass.com
Unlock document

This preview shows half of the first page of the document.
Unlock all 2 pages and 3 million more documents.

Already have an account? Log in

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers

Related Documents