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.")

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

(python)

Find at least 12 issues in the code.

  1. A = int(input("Enter a number for A: "))
  2. B = str(input("Enter a number for B: "))
  3. C = int(input("Enter a number for C: "))
  4. #Check that user input for A is not 0.
  5. if A = 0:
  6.     print("Your coefficient for 'A' MUST BE a value greater than 0, otherwise your equation is not a quadratic!")
  7.     int(input(Please enter a new value for a:")) = A
  8. import math:
  9. //Compute the discriminant.
  10. disc = (B*B) - (4*A*C)
  11. #Display the disciminant computed.
  12. print("\nThe discriminant of your equation is", str(disc) + ".")
  13. #Check the sign of the computed discriminant
  14. if disc == 0:
  15.     print("This equation has 1 real solution.")
  16.     x = (-B + math.sqrt(disc)) / (2 * A)
  17.     print("The solution to your equation is:", x)
  18. elif disc > 0
  19.     print("This equation has 2 real solutions.")
  20.     x1 == (-B + math.sqrt(disc)) / (2 * A)
  21.     x2 == (-B - math.sqrt(disc)) / (2 * A)
  22.     print("One solution to your equation is:", x1)
  23.     print("The other solution to your equation is:" + x2)
  24. else if disc  < 0:
  25.     print "This equation has 2 imaginary solutions.")
Expert Solution
Step 1
    1. A = int(input("Enter a number for A: "))
    2. B = str(input("Enter a number for B: "))
    3. C = int(input("Enter a number for C: "))
    4. #Check that user input for A is not 0.
    5. if A = 0:
    6.     print("Your coefficient for 'A' MUST BE a value greater than 0, otherwise your equation is not a quadratic!")
    7.     int(input(Please enter a new value for a:")) = A
    8. import math:
    9. //Compute the discriminant.
    10. disc = (B*B) - (4*A*C)
    11. #Display the disciminant computed.
    12. print("\nThe discriminant of your equation is", str(disc) + ".")
    13. #Check the sign of the computed discriminant
    14. if disc == 0:
    15.     print("This equation has 1 real solution.")
    16.     x = (-B + math.sqrt(disc)) / (2 * A)
    17.     print("The solution to your equation is:", x)
    18. elif disc > 0
    19.     print("This equation has 2 real solutions.")
    20.     x1 == (-B + math.sqrt(disc)) / (2 * A)
    21.     x2 == (-B - math.sqrt(disc)) / (2 * A)
    22.     print("One solution to your equation is:", x1)
    23.     print("The other solution to your equation is:" + x2)
    24. else if disc  < 0:
    25.     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.

steps

Step by step

Solved in 2 steps with 1 images

Blurred answer
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education