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

Answers

Answer 1

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!


Related Questions

How do I charge my ACDC Halo bolt?

Answers

Answer:

To recharge your HALO Bolt, using the provided AC wall adapter cable, plug the AC adapter tip into the charger's charge input DC 20V/0.6A port. Next, connect the AC adapter into a wall outlet. Your HALO Bolt will automatically begin charging. Charge your HALO Bolt for a full eight hours.

Explanation:

Write pseudocode for a function that translates a telephone number with letters in it (such as 1-800-FLOWERS) into the actual phone number. Use the standard letters on a phone pad.

Answers

Answer:

Explanation:

Function telToNumbers with one parameter of a String input for the telephoneNumber

String var newTelephoneNum;

for loop through telephoneNumber {

Char var currentChar = current Character in the loop;

currentChar to lower Case;

Switch statement (currentChar) {

 case "a" or "b" or "c" : newTelephoneNum += "2"; break;

 case "d" or "e" or "f" : newTelephoneNum += "3"; break;

 case "g" or "h" or "i" : newTelephoneNum += "4"; break;

 case "j" or "k" or "l" : newTelephoneNum += "5"; break;

 case "m" or "n" or "o" : newTelephoneNum += "6"; break;

 case "p" or "q" or "r" or "s" : newTelephoneNum += "7"; break;

 case "t" or "u" or "v" : newTelephoneNum += "8"; break;

 case "w" or "x" or "y" or "z" : newTelephoneNum += "9"; break;

 default : newTelephoneNum += currentChar; break;

 }

}

print newTelephoneNum;

How did Aryan religion contribute to class differences in India?​

Answers

According to traditional theories the Indian caste system has its origins in the advent of the Aryans in the Indus Valley.

g You and your friend both send documents to the printer, but the printer can only print one document at a time. What does it do with the other document

Answers

Answer:

It places the document in a buffer

Explanation:

Since the printer can only print a document at a time, the other document is going to be placed in a buffer.

The print buffer can be described as a location in memory that has the function of holding data that is going to be sent to a computers printer. A print job such as in this scenario may remain in the buffer because another document is to be printed first.

Sometimes a document could be put in the buffer because the computer is waiting for the printer to respond. This is just another reason why documents are placed in a buffer.

Corina has added animations to objects on a particular slide within a presentation. She needs to reorder the animations. How should she achieve this goal?

A. Use the Preview button.
B. Access the Advanced timeline.
C. Use the Animation pane.
D. Delete and recreate the animations in the correct order.

Answers

I think it's B but im not 100% sure sorry if im wrong

Answer: C

Explanation:

PLzzzzzz help me!! I will mark brainiest to the one who answers it right!!
Answer it quickly!!

Write a pseudo code for an algorithm to center a title in a word processor.

Answers

Answer: abstract algebra

Explanation: start with the algorithm you are using, and phrase it using words that are easily transcribed into computer instructions.

Indent when you are enclosing instructions within a loop or a conditional clause. ...

Avoid words associated with a certain kind of computer language.

Answer:

(Answers may vary.)

Open the document using word processing software.

In the document, select the title that you want to center. The selected word is highlighted.

On the Menu bar, select the Format tab.

In the Format menu, select Paragraph.

The Paragraph dialog box opens with two sub tabs: Indents and Spacing, and Page and Line Breaks. The first tab is selected by default.

Adjust the indentation for the left and right side. Ensure that both sides are equal.

Preview the change at the bottom of the dialog box.

Click OK if correct, otherwise click Cancel to undo changes.

If you clicked OK, the title is now centered.

If you clicked Cancel, the title will remain as it is.

Explanation:

I took the unit activity

Help me! I’ll mark you brainly and give extra points!

Answers

Answer:

52 5,

Explanation:

what makes a computer a computer?​

Answers

Answer:

A computer is an electronic device that manipulates information, or data. It has the ability to store, retrieve, and process data. You may already know that you can use a computer to type documents, send email, play games, and browse the Web

Explanation:

Follow me..............

central processor unit (CPU)

memory (ram)

input (mouse keyboard)

output (monitor or printer)

browse the web

ability to store retrieve and process data

I don't rlly know much about technology but I hope this helps

Given two integer variables distance and speed, write an expression that divides distance by speed using floating point arithmetic, i.e. a fractional result should be produced.
1. Calculate the average (as a double) of the values contained in the integer variables num1, num2, num3 and assign that average to the double variable avg. Assume the variables num1, num2, and num3 have been declared and assigned values, and the variable avg declared.
Creating objects
2. Declare a reference variable of type File named myFile.
3. Declare a variable named myMenu suitable for holding references to Menu objects.
4. Suppose a reference variable of type File called myFile has already been declared. Create an object of type File with the initial file name input.dat and assign it to the reference variable myFile.
invoking methods

Answers

Answer:

Following are the solution to this question:

Explanation:

In this question, the result value which would be produced are as follows:

[tex]= \frac{distance}{(double) \ speed}[/tex]

In point 1:

The formula for the avg variable:

[tex]\to avg = \frac{(num_1 + num_2 + num_3)}{(double)\ 3};[/tex]

In point 2:

The variable for the file is:

File myFile;

In point 3:

The variable for the mymenu:

Menu myMenu;

In point 4:

myString = new String();

Write a method called rotate that moves the value at the front of a list of integers to the end of the list. For example, if a variable called list stores the values [8, 23, 19, 7, 45, 98, 102, 4], then the call of list.rotate(); should move the value 8 from the front of the list to the back of the list, changing the list to store [23, 19, 7, 45, 98, 102, 4, 8]. If the method is called for a list of 0 elements or 1 element, it should have no effect on the list. You may neither construct any new nodes to solve this problem nor change any of the data values stored in the nodes. You must solve the problem by rearranging the links of the list.

Answers

Answer:

Explanation:

public void rotate()

{

if(front == null)

return;

ListNode current = front;

ListNode firstNode = current;

while(current.next != null)

{

current = current.next;

}

current.next = front;

front = firstNode.next;

firstNode.next = null;

}

________ help(s) prevent a hard drive from being a single point of failure. __________ help(s) prevent a server from being a single point of failure. _________ help(s) prevent a person from being a single point of failure.

Answers

Answer:

RAID, Failover clusters, Cross-training

Explanation:

RAID function by preventing a hard drive from being a single point of failure. It is called Redundant array of independent disks (RAID). Failover cluster duties is to prevent a server from being a single point of failure.requires at least 2 node

Write an If/else statement to check whether host is online. If it is online, then print system is online otherwise print system is unreachable.

Answers

Answer:

from socket import *

hostname = input('Enter the host to be scanned: ')

ip_add = gethostbyname(hostname)

connections = [ ]    

for i in range(133, 136):

   s = socket(AF_INET, SOCK_STREAM)

     

   conn = s.connect_ex((ip_add, i))

   print(conn)

   connections.append(conn)

if 0 in connections:

   print ('Host is online')

   s.close()

else:

   print ('system is unreachable')

Explanation:

The python source code above scans for all the available range of ports in the provided hostname, if any port is available, the host is online else the program print the error message "system is unreachable.

How does a search engine use algorithms to provide search results?

by creating keywords and phrases
by recording and storing data for worldwide use
by retrieving and ranking relevant search results
by limiting the type of search terms that it will accept

Answers

Answer:

By retrieving and ranking relevant search results

Explanation:

A search engine use algorithms to provide search results by retrieving and ranking relevant search results. The correct option is c.

What is an algorithm?

When a user enters a search query into a search engine, all of the sites that are considered relevant are pulled from the index and ranked in a set of results using a hierarchical algorithm.

Each search engine uses a different set of algorithms to determine which results are the most pertinent. Through tags like HREF and SRC, they may detect new links on these pages, and they add such pages to their list of sites to index.

Then, based on the search phrases you entered, search engines utilize their algorithms to produce a prioritized list from their index of the pages you should be most interested in.

Therefore, the correct option is c. by retrieving and ranking relevant search results

To learn more about the algorithm, refer to the link:

https://brainly.com/question/13092388

#SPJ6

Write the definition of a function that takes as input three numbers. The function returns true if the floor of the product of the first two numbers equals the floor of the third number; otherwise it returns false. (Assume that the three numbers are of type double.) (4)

Answers

Answer:

Written in C++

bool checkfloor(double num1, double num2, double num3) {

   if(floor(num1 * num2) == floor(num3)){

       return true;

   }

   else {

       return false;

   }

}

Explanation:

The function written in C++

This line defines the function

bool checkfloor(double num1, double num2, double num3) {

The following if condition checks if the floor of num1 * num2 equals num3

   if(floor(num1 * num2) == floor(num3)){

       return true; It returns true, if yes

   }

   else {

       return false; It returns false, if otherwise

   }

}

See attachment for full program including the main

identify 5 products/services needed by the people in our current situation.

Answers

Answers with Explanations:

5 Products/Services Needed by People These Days.

1. Face mask/Surgical mask - The use of face mask is considered a common sense. Most countries mandate people to wear this every time they go out.

2. Food Delivery service - To prevent contracting corona virus, most people prefer to have their food delivered than to dine out. This increases the demand for the food delivery service.

3. Alcohol - It has become an important habit recently to disinfect hands and other things. This is also being advertised on TV, thus many people carry it along with them.

4. Infrared Forehead Thermometer - Many establishments use this in order to quickly check the temperature of people entering.

5. Internet service - The increase use of this service is due to online learning and remote-working situations.

We all need different product and services. In this pandemic time, the products/services needed by the people are;

Face mask or Surgical mask

All round Food Delivery service  

Humanitarian gestures by people or firms and also Good Tv programs that are educative and one can watch with kids them.

Infrared Forehead Thermometer  

Internet service

A product is known to be a tangible goods that one buys or acquisition,  consume, etc.  Service is known as an intangible item.

A key reason for any new development is to give the best or new value to the customer and in this present time. Helping those who have lost their jobs, having mask mask,  etc., readily available will go a long way to help.

Learn more about Products from

https://brainly.com/question/10873737

Which of the following would be appropriate to create using the CMYK color model?

Select all that apply.

a printed takeout menu a printed takeout menu , ,

a photography blog a photography blog , ,

a tri-fold brochure a tri-fold brochure , ,

a mobile app logo

Answers

Answer:

B, and C

Explanation:

they look like the only two answers that make sence

The document ____ controls the variety of fonts, colors, and other visual effects available for formatting a document.

Answers

Answer:

Theme

Explanation:

In Microsoft Office particularly Microsoft Word, the document THEME is where a user can quickly go to in order to controls the variety of fonts, colors, and other visual effects available for formatting a document.

To do this, a user can click on the Design menu, then click on the THEME option, after that, a user can hover the mouse on different themes to preview how the effects will show on the text or page in the document, before settling for one.

Which choices correctly describe an Else
statement? Check all that apply.
a conditional statement that will show
different information if the answer to the If
statement is true
a conditional statement that will show
different information after the If statement
answer is false
a statement that contains the code to be
executed when the If value is false or zero
a conditional statement that runs a piece of
code when all program statements are true

Answers

Answer: B C

Explanation:

Answer:B,C,D

Explanation:

A database has one physical schema and one conceptual (logical) schema but many external schemas (views).
a) True
b) False

Answers

Answer:

true

Explanation:

A database has one physical schema and one conceptual (logical) schema but many external schemas (views): a. True.

A database refers to a structured (organized) collection of data that are stored on a computer system and usually accessed in various ways such as electronically.

In database management, a database schema can be defined as a structure which is typically used to represent the logical design of the database. Thus, it denotes how data are stored (organized) and the relationships existing in a database management system (DBMS).

Generally, there are two (2) main types of a database schema and these include;

Physical database schema: it is only one per database.Conceptual (logical) schema: it is only one per database.

However, there are multiple number of external schemas (views) for each database because it is what an end user is interested in.

Read more on database here: https://brainly.com/question/3259292

Why is it useful to teach Karl new commands

Answers

Answer:

It's important to teach karl more commands so karl can do more tasks and create more complex algorithms

Explanation:

it’s useful because they would know what to do when you say something . example of you say turn left they would not know what to do because they have not been taught . that’s why you should teach them new commands .

Write a Pandas program to import excel data (coalpublic2013.xlsx) into a dataframe and draw a bar plot where each bar will represent one of the top 10 production.

Answers

Answer:

import pandas as pd

import numpy as np

import matplotlib.pyplot as plt

df = pd.read_excel('coalpublic2013.xlsx')

sorted_by_production = df.sort_values(['Production'], ascending=False).head(10)

sorted_by_production['Production'].head(10).plot(kind="bar")

plt.show()

Explanation:

The python program plot a bar chart of the top ten productions in the excel worksheet. The excel file is read in as a pandas dataframe, sorted in descending order and the first ten of the dataframe is plotted as a bar plot.

If you need to download something for a class, first

Answers

Answer:

left click, then click save image

Explanation:

Answer:

first try to do it on kami, then on Google docs, then on doc-hub

As a user of media what will you say to those people who are under of misleading use media

Answers

Answer:

search more sa google

if you make homemade knitted garments and you sell them to individuals online, what e-commerce are you participating in?
is it B2B or B2C or C2C or SaaS

Answers

The Answer Of This Question Is C2C.

Which function converts the users input to a number without a decimal?

Answers

Answer:

Explanation: integer is the meaning of int() if you payed attention to programming class, int() would be a WHOLE number and not a decimal number, 2nd of all, a decimal number would be float() so the answer is int() hope i helped!

Explanation:

hope this helped byyyyyyyyyyye

Type the correct answer in the box. Spell the word correctly.
Under which menu option of a word processing program does a star appear?
A star appears under the
menu of the word processing program.
Reset
Next

Answers

Answer:

"a callout is a type of text box that also includes a line for pointing to any location on the document. A callout appears under the SHAPES menu of the word processing program. The answer that completes this statement is the word "shapes". Hope this answers your question."

Explanation:

The correct answer in the box is as follows:

A star appears under the shapes menu of the word processing program.

What is the word processing program?

The word processing program may be characterized as a type of MS software that is significantly used to create, edit, save, and print documents on a computer. It permits a user to create documents that mimic the format and style of the original document along with diverse functions.

The Shapes menu in the word processing program has numerous shapes like rectangles, Ellipses, and Freehand polygons. There are some other numbers of other shapes such as arrows, speech balloons, various stars, and others are also included in this menu tool.

If a user wants to add any specific shape, he/she is allowed to click Insert, click Shapes, select a shape, and then click and drag to draw the shape. That specific shape is now inserted in the word processing documents.

Therefore, a star appears under the shapes menu of the word processing program.

To learn more about Word processing documents, refer to the link:

https://brainly.com/question/1596648

#SPJ7

Review how to write a for loop by choosing the output of this short program.

for counter in range(3):
print(counter * 2)

2
3
4


0
2
4


0
1
2


2
4
6

Answers

Answer:

The answer is 0 2 4. I hope this helps you out. Have a wonderful day and stay safe.

Explanation:

Answer: 0 2 4

Explanation: got it right on edgen

Write code which takes a sentence as an input from the user and then prints the length of the first word in that sentence.
Hint: think about how you know where the first word ends - you may assume that the sentence contains more than one word.
Input a code in the following:
/* Lesson 3 Coding Activity Question 4 */
import java.util.Scanner;
public class U2_L3_Activity_Four{
public static void main(String[] args){
/* Write your code here */
}
}

Answers

import java.util.Scanner;

public class U2_L3_Activity_Four {

   public static void main(String[] args) {

       Scanner scan = new Scanner(System.in);

       System.out.println("Enter a sentence.");

       String sent = scan.nextLine();

       int count = 0;

       for (int i = 0; i < sent.length(); i++){

           char c = sent.charAt(i);

           if (c != ' '){

               count++;

       }

           else{

               break;

           }

       

   }

       System.out.println("The first word is " + count +" letters long");

   

   }

}

We check to see when the first space occurs in our string and we add one to our count variable for every letter before that. I hope this helps!

Following are the java code to the given question:

import java.util.Scanner;//import package

public class U2_L3_Activity_Four //defining a class U2_L3_Activity_Four

{

  public static void main(String[] args) //defining main method

  {

      String s;//defining String variable

      int x,v=0;//dclaring integer variable x,v

      Scanner obx = new Scanner(System.in);//creating Scanner class Object

      System.out.println("Enter a sentence.");//print message

      s = obx.nextLine();//input string value

      for (x = 0; x < s.length(); x++)//defining loop to count string length

      {

          char c = s.charAt(x);//defining char variable that hold char value

          if (c != ' ')//defining if that check space value

          {

              v++;

          }

      }

      System.out.println("The first word is " + v +" letters long");//print length of first word

  }

}

Output:

Please find the attached file.

Program Explanation:

Import package.Defining a class U2_L3_Activity_Four, inside the class main method is declared.Defining a string variable "s" and an integer variable "x,v=0", and a scanner class object is created that inputs string value.In the next step, a for loop is defined that checks the first word in the string value and prints its length value.

Learn more:

brainly.com/question/16092924

Write an expression that prints 'You must be rich!' if the variables young and famous are both True.
young = True
famous = False
if ''' Your solution goes here ''':
print('You must be rich!')
else:
print('There is always the lottery...')
Python 3 language

Answers

Answer:

Following are the expression to this question:

if (young and famous==True):

Explanation:

For print, the given expression the code requires some modification that can be defined as follows:

young = True#defining a bool variable that holds a value True

famous = True#defining a bool variable that holds a value True

if (young and famous==True):#defining if block that check variable value

   print('You must be rich!')#print message

else:#else block  

   print('There is always the lottery...')#print message

Output:

You must be rich!

Code explanation:

In the above-given code, two variable "young and famous" is declared, that hold a "True" which is a bool value, in this code, a conditional statement has used, that checks variable value, which can be defined as follows:

In the if block, it uses the above declared variable with and gate to check its value is equal to true. If the condition is true, it will print the true block message, otherwise, go to the else block in this, it will print the else block message.

What is the role of CPU in the computer system?

Answers

Answer:

role of cpu in computer is ut is a brain nd a power point if a computer

Explanation:

It helps of shut down and open it

Answer:

CPU is considered as the brain of the computer. CPU performs all types of data processing operations. It stores data, intermediate results, and instructions (program). It controls the operation of all parts of the computer.

Other Questions
what is the reciprocal of 5 !!!help !! Why was the Aguayo Expedition successful? Why did these members of Parliament send this letter? They thought the Prince of Orange had a better claim to the throne than James II. They wanted an absolute ruler like Louis XIV. They were determined to have a limited monarchy, and James II would not agree. They wanted a king who would protect the rights of Catholics in England. What is the value (in degrees) of angle Z1?55 The Kuiper Belt is estimated to be about 3,000,000 meters wide. Which value represents the estimated width of the Kuiper Belt, in meters, in scientific notation? Help fast Fast Fast Fast How is the Mexican constitution of 1824 similar and different from the United states constitution What is the value of y in the equation 9 + y = 8? this is extremely time sensitive The town of Parkville has 12 gas stations. It also has 16 parking lots. Alarge number of commuters pass through daily on the way to CedarCity.Which statement best evaluates the use of a claim and evidence?A. The passage has a strong claim backed up by sound reasoning.B. The passage does not have a claim and does not contain anysound reasoning.C. The passage does not have a claim but does contain soundreasoning.D. The passage has a strong claim that is not backed up by soundreasoning Solve the equation 3(x-5) - 5x = -25 + 6x -125 Help what is the equal to Can you change your cultural identity by changing your name and what you wear? help me fast please I give brainliest answer Yall help please I would appreciate it Help ASAP if you want brainliest, five stars, thanks, and friends list. What were Adam Smith's two laws that governed all business and economic activity? Which practice can help prevent cross-contamination?A. storing ready-to-eat food below raw food in a coolerB. keeping food items in any covered durable containersC. using same equipment for prepping raw and ready-to-eat foodD. keeping single-use items in their original packagingE. cooling hot food by placing it on a prep counter overnight The value of y varies directly with the value of x. If y = 37, then x = 25. What is the value of y when x = 50. (Will give brainliest !!!) A drill is used to dig down into the earth. After 2 hours, the drill is 12 meters below the surface. After 5 hours, the drill is 30 meters below the surface. Which equation represents the depth of the drill in meters, y, after x hours of drilling? HELPPPPP its science, fill in the blanks. fake answers will be reported