python) Find at least 12 issues in the code. A = int(input("Enter a number for A: ")) B = str(input("Enter a number for B: ")) C = int(input("Enter a number for C: ")) #Check that user input for A is not 0. if A = 0: print("Your coefficient for 'A' MUST BE a value greater than 0, otherwise your equation is not a quadratic!") int(input(Please enter a new value for a:")) = A import math: //Compute the discriminant. disc = (B*B) - (4*A*C) #Display the disciminant computed. print("\nThe discriminant of your equation is", str(disc) + ".") #Check the sign of the computed discriminant if disc == 0: print("This equation has 1 real solution.") x = (-B + math.sqrt(disc)) / (2 * A) print("The solution to your equation is:", x) elif disc > 0 print("This equation has 2 real solutions.") x1 == (-B + math.sqrt(disc)) / (2 * A) x2 == (-B - math.sqrt(disc)) / (2 * A) print("One solution to your equation is:", x1) print("The other solution to your equation is:" + x2) else if disc < 0: print "This equation has 2 imaginary solutions.")
(python)
Find at least 12 issues in the code.
- A = int(input("Enter a number for A: "))
- B = str(input("Enter a number for B: "))
- C = int(input("Enter a number for C: "))
- #Check that user input for A is not 0.
- if A = 0:
- print("Your coefficient for 'A' MUST BE a value greater than 0, otherwise your equation is not a quadratic!")
- int(input(Please enter a new value for a:")) = A
- import math:
- //Compute the discriminant.
- disc = (B*B) - (4*A*C)
- #Display the disciminant computed.
- print("\nThe discriminant of your equation is", str(disc) + ".")
- #Check the sign of the computed discriminant
- if disc == 0:
- print("This equation has 1 real solution.")
- x = (-B + math.sqrt(disc)) / (2 * A)
- print("The solution to your equation is:", x)
- elif disc > 0
- print("This equation has 2 real solutions.")
- x1 == (-B + math.sqrt(disc)) / (2 * A)
- x2 == (-B - math.sqrt(disc)) / (2 * A)
- print("One solution to your equation is:", x1)
- print("The other solution to your equation is:" + x2)
- else if disc < 0:
- print "This equation has 2 imaginary solutions.")
-
- A = int(input("Enter a number for A: "))
- B = str(input("Enter a number for B: "))
- C = int(input("Enter a number for C: "))
- #Check that user input for A is not 0.
- if A = 0:
- print("Your coefficient for 'A' MUST BE a value greater than 0, otherwise your equation is not a quadratic!")
- int(input(Please enter a new value for a:")) = A
- import math:
- //Compute the discriminant.
- disc = (B*B) - (4*A*C)
- #Display the disciminant computed.
- print("\nThe discriminant of your equation is", str(disc) + ".")
- #Check the sign of the computed discriminant
- if disc == 0:
- print("This equation has 1 real solution.")
- x = (-B + math.sqrt(disc)) / (2 * A)
- print("The solution to your equation is:", x)
- elif disc > 0
- print("This equation has 2 real solutions.")
- x1 == (-B + math.sqrt(disc)) / (2 * A)
- x2 == (-B - math.sqrt(disc)) / (2 * A)
- print("One solution to your equation is:", x1)
- print("The other solution to your equation is:" + x2)
- else if disc < 0:
- print "This equation has 2 imaginary solutions.")
all the bold sentence in program has error
Correct program
A = int(input("Enter a number for A: "))
B = int(input("Enter a number for B: "))
C = int(input("Enter a number for C: "))
if A == 0:
print("Your coefficient for 'A' MUST BE a value greater than 0, otherwise your equation is not a quadratic!")
A=int(input("Please enter a new value for a:"))
import math
#Compute the discriminant.
disc = (B*B) - (4*A*C)
#Display the disciminant computed.
print("\nThe discriminant of your equation is", str(disc) + ".")
#Check the sign of the computed discriminant
if disc == 0:
print("This equation has 1 real solution.")
x = (-B + math.sqrt(disc)) / (2 * A)
print("The solution to your equation is:", x)
elif disc > 0:
print("This equation has 2 real solutions.")
x1 == (-B + math.sqrt(disc)) / (2 * A)
x2 == (-B - math.sqrt(disc)) / (2 * A)
print("One solution to your equation is:", x1)
print("The other solution to your equation is:" + x2)
elif disc < 0:
print ("This equation has 2 imaginary solutions.")output
Enter a number for A: 2
Enter a number for B: 3
Enter a number for C: 4
The discriminant of your equation is -23.
This equation has 2 imaginary solutions.
Step by step
Solved in 2 steps with 1 images