You are given a polynomial function, in the following format:
\$x = (c_0 * y^0) + (c_1 * y^1) + (c_2 * y^2) + ... + (c_n * y^n)\$
where \$c_n\$ stands for the coefficient of the \$n^{th}\$ power of \$y\$
You have to plot the equation on a \$10 * 10\$ ASCII matrix. The value must be floored to an integer before plotting. If \$y < 0\$ or \$y > 9\$, then do not plot. For simplicity, we are assuming the top left corner to be \$(0,0)\$.
A .
represents an empty space, and *
represents a point on the graph. You can choose any characters to represent both of the things as per your convenience but do mention what you use in your answer.
You may take the input as a list/array of coefficients, or, as a string in the above specified format.
Examples:
Input -> x = (1 * y^1)
Output ->
*.........
.*........
..*.......
...*......
....*.....
.....*....
......*...
.......*..
........*.
.........*
Input -> x = (9 * y^0) + (-1 * y^1)
Output ->
.........*
........*.
.......*..
......*...
.....*....
....*.....
...*......
..*.......
.*........
*.........
Input -> x = (0.10 * y^2)
Output ->
*.........
*.........
*.........
*.........
.*........
..*.......
...*......
....*.....
......*...
........*.
Input -> x = (3 * y^1)
*.........
...*......
......*...
.........*
..........
..........
..........
..........
..........
..........
Hint: eval can be helpful here.
Inspired by a clash of code problem from https://www.codingame.com/