# COMP9021辅导Python | PRINCIPLES OF PROGRAMMING QUIZ 8

QUIZ 8
COMP9021 PRINCIPLES OF PROGRAMMING
\$ python3

>>> from quiz_8 import *
>>> line = Line(Point(4, 8), Point(4, 8))
Traceback (most recent call last):

quiz_8.LineError: Cannot create line
>>> pt_11 = Point(-2, 5)
>>> pt_12 = Point(6, 1)
>>> pt_21 = Point(0, 6)
>>> pt_22 = Point(-1, 0)
>>> pt_31 = Point(2, -1)
>>> pt_32 = Point(3, 5)
>>> pt_41 = Point(-3, 3)
>>> pt_42 = Point(1, 1)
>>> line_1 = Line(pt_11, pt_12)
>>> line_2 = Line(pt_21, pt_22)
>>> line_3 = Line(pt_31, pt_32)
>>> line_4 = Line(pt_41, pt_42)
>>> line = Line(Point(4, -2), Point(6, 10))
>>> parallelogram = Parallelogram(line, line_2, line_3, line_4)
Traceback (most recent call last):

quiz_8.ParallelogramError: Cannot create parallelogram
>>> parallelogram = Parallelogram(line_1, line_2, line_3, line_1)
Traceback (most recent call last):

quiz_8.ParallelogramError: Cannot create parallelogram
>>> line = Line(pt_41, Point(1, 2))
>>> parallelogram = Parallelogram(line_1, line_2, line_3, line)
Traceback (most recent call last):

quiz_8.ParallelogramError: Cannot create parallelogram
Date: Trimester 2, 2019.

2 COMP9021 PRINCIPLES OF PROGRAMMING
>>> parallelogram = Parallelogram(line_1, line_2, line_3, line_4)
>>> pt_1 = Point(-1, 4)
>>> pt_2 = Point(2, 2)
>>> line = Line(pt_1, pt_2)
>>> parallelogram.divides_into_two_parallelograms(line)
False
>>> pt_1 = Point(-2, 4)
>>> line = Line(pt_1, pt_2)
>>> parallelogram.divides_into_two_parallelograms(line)
True
>>> parallelogram.divides_into_two_parallelograms(line_2)
False
>>> line = Line(Point(0, -2), Point(0, 7))
>>> parallelogram.divides_into_two_parallelograms(line)
False
>>> line = Line(Point(-1, -3), Point(2, 15))
>>> parallelogram.divides_into_two_parallelograms(line)
True

E-mail: vipdue@outlook.com  微信号:vipdue