1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
laila [671]
3 years ago
14

The two roots of a quadratic equation, for example 2 + + = 0, can be obtained using the following formula: Two Roots: 1 = − + √

2−4 2 and 2 = − − √ 2−4 2 2 − 4 is called the discriminant of the quadratic equation. If it is positive, the equation has two real roots. If it is zero, the equation has one root. If it is negative, the equation has no real roots. One Root: 1 = − 2 Write a program that prompts the user to enter values for a, b, and c and displays the result based on the discriminant. If the discriminant is positive, display two roots. If the discriminant is 0, display one root. Otherwise, display The equation has no real roots.
Here are some sample runs:
Enter a, b, c: 1.0, 3, 1
The roots are -0.381966 and -2.61803
Enter a, b, c: 1, 2.0, 1
The root is -1.0
Enter a, b, c: 1, 2, 3
The equation has no real roots
Computers and Technology
1 answer:
Vladimir79 [104]3 years ago
5 0

lst = input("Enter a,b,c: ").split(",")

a = float(lst[0])

b = float(lst[1])

c = float(lst[2])

root1 = (-b + ((b**2-(4*a*c))**0.5))/(2*a)

root2 = (-b - ((b**2-(4*a*c))**0.5))/(2*a)

dis = b**2 - (4*a*c)

if dis > 0:

   print("The roots are {} and {}".format(root1, root2))

elif dis < 0:

   print("The equation has no real roots")

else:

   print("The root is {}".format(root1))

I wrote my code in python 3.8. I hope this helps!

You might be interested in
During the first six months of his job, Enrique's boss gave him weekly feedback about his performance. What component of effecti
Nat2105 [25]
Being direct I think because Enrique’s boss is being direct about his work and making sure he does his job. The other options don’t sound right
8 0
3 years ago
i need help or good site for my project topic: identification of problems hindering effective teaching and learning of computer
attashe74 [19]

Answer:

they learn how to be independent

and how to create their website at the young age and who make money and create jods

like me I'm learning IT at katlehong secondary school

and I'm now to create my website

4 0
3 years ago
Convert the Binary Number to a Decimal Number
Korolek [52]
There are convertors online for this but the answer is 5
<span />
8 0
4 years ago
PLZ BEEN STUCK ON THIS
Gnoma [55]

Answer:

am not really sure but between TCP/IP and data link am sorry for not being precise .

6 0
3 years ago
Read 2 more answers
In the current situation, how do you access information as a student? How will you integrate the use of ICT in your daily life a
3241004551 [841]

Answer:

Explanation:

As a computer science student information is accessed in every possible way. This can be through a local school lan network, mobile devices, e-mail, etc. All of these help information flow to and from various people and makes obtaining this information incredibly simple as a student. Especially in the field of computer science, I need to integrate as many ICT devices with me in my everyday life, to send emails, check calendar updates, research information on the web, check school reports, and even speak with clients.

3 0
3 years ago
Other questions:
  • What is a drawback to being in Slide Show mode? a- Being able to review each slide in order
    8·2 answers
  • (tco 9) the most common protocol(s) used for sending and retrieving e-mail is(are) _____.
    11·1 answer
  • When should students practice netiquette in an online course? Check all that apply.
    14·2 answers
  • Which option can Jesse use to customize her company’s logo, name, address, and similar details in all her business documents?
    6·1 answer
  • Wrire a code that display elements at indices 1 and 4 in the follwoing array.
    12·1 answer
  • What safety feature melts to protect a circuit? a. fuse b. diode c. three-prong plug d. transistor
    10·2 answers
  • Which step is first in changing the proofing language of an entire document?
    11·1 answer
  • Which types of files can be used to define Kubernetes manifest files? yaml, json, yaml and text files
    5·1 answer
  • Mai lee wants to add a graphic demonstrating a process in her document. which of the following commands should she click in the
    5·1 answer
  • The discipline of building hardware architectures, operating systems, and specialized algorithms for running a program on a clus
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!