124k views
5 votes
This is using python.

Assuming all the variables are non-zero.

Which lines of code will assign the discriminant the value b2−4ac? Select 2 options.


discriminant = bb - 4ac

discriminant = b * b - 4 * a * c

discriminant = b ^ 2 - 4ac

discriminant = b ** 2 - 4 * a * c

discriminant = b ^ 2 - 4 * a * c

User Lulhum
by
4.3k points

2 Answers

4 votes

Answer:

discriminant = b * b - 4 * a * c

discriminant = b ** 2 - 4 * a * c

Step-by-step explanation:

The operands are correct and in the right order (for python).

** is the operand for squaring something.

* is the operand for multiplying something.

- is the operand for subtracting something.

User Sumama Waheed
by
4.8k points
3 votes

Let's take a look at these examples individually.

discriminant = bb - 4ac. You have to use the * sign so the computer understands that you're trying to multiply two objects together.

discriminant = b * b - 4 * a * c. This example works because it's using the * where it's appropriate.

discriminant = b ^ 2 - 4ac. In python we don't use the ^ sign. To use exponents, we use **. Also, there is no * sign in between 4, a, and c.

discriminant = b ** 2 - 4 * a * c. This example works because it uses the ** and * sign where appropriate.

discriminant = b ^ 2 - 4 * a * c. This example uses the ^ sign and python does not support it.

User MdsAyubi
by
4.4k points