Quadratic.py

Problem

You need to write a program that outputs the coefficients of a polynomial with user-provided roots (x-intercepts).

Example:

> first root: -1

> second root: 3

> 1 -2 -3


corresponding to :

Notice how that quadratic factors to (x+1) and (x-3), which has roots at -1 and 3.

Testing

Your program should follow these outputs. Test your code on your own and see if it creates the right thing!


> first root: 1

> second root: 2

> 1 -3 2


> first root: -5

> second root: 3

> 1 2 -15


> first root: 1

> second root: foo

> (program quits and there's an error)


Submission

You should save and name your file as "lastname_quadratic.py", and turn it in on Google Classroom with your other two programs.

Videos