CSC148H1 Study Guide - Final Guide: Init, Priority Queue

70 views3 pages
16 Oct 2011
School
Course
Professor
katrinasavvy and 38715 others unlocked
CSC148H1 Full Course Notes
1
CSC148H1 Full Course Notes
Verified Note
1 document

Document Summary

Import media from oval import oval from line import line from rectangle import rectangle class priorityqueue(): """ create a way to store the order in which the shapes are to be drawn onto the picture def __init__(self, list=[]): """ initialize the priority_queue and then fill it with the contents of list. If list is not provided it defaults to empty self. priority_queue = {} if len(list) > 0: # if the list contains any shape objects for shape in list: # get the current shape"s priority self. current_shape_priority = shape. get_priority() # if the current_shape_priority already exists as a key in. # the dictionary priority_queue, append the shape object to the if self. current_shape_priority in self. priority_queue: self. priority_queue[self. current_shape_priority]\ # as a key, therefore create a new list ???? self. priority_queue[self. current_shape_priority] = """ return the string representation of every shape in the priority_queue by indicating the kind of shape it is, and then indicating its coordinates self. return_string = ""

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

Related Questions