Back to Freecodecamp

How to Solve for X: Extra

curriculum/challenges/english/blocks/learn-how-to-solve-for-x/6331d233b51aeedd1a2bd645.md

latest1.1 KB
Original Source

--description--

This video will go deeper, with more examples of how to use SymPy solve. It will also explain how the practice functions generate the random problems.

Here is the <a href="https://colab.research.google.com/drive/1Jv6WxW93J_1GZao8DkNb4X0D93oVibbs" target="_blank" rel="noopener noreferrer nofollow">Colab notebook to go along with this video.</a> Use it to add more to the algebra Colab notebook that you are building.

--assignment--

Add the code for more ways to solve for x from the video to your algebra Colab notebook.


Open the following Colab notebook, run the cell, and <a href="https://colab.research.google.com/drive/1XjmHoERFKcvol7FPidQE-wgdvR82HV45" target="_blank" rel="noopener noreferrer nofollow">practice solving one and two-step algebra problems.</a> As a bonus, look at the code that generates the practice problems.

--questions--

--text--

If you import sympy and define x as a variable, what would be the output from the following code?

py
example = 3*x - 12
equation = Eq(example,0)
solution = solve(equation,x)
print(solution)

--answers--

3


4


[4]


x = 4

--video-solution--

3