Question

1 a - int(input(Enter a: )) 2 b - int(input(Enter b: )) 3 C = int(input(Enter c: )) 4 5 # calculate xi and x2 6 x1 - (b
1: Compare output 1 A 0/6 Traceback (most recent call last): File main.py, line 6, in <module> x1 - (-b+math.sqrt (b**2-4*a
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Enter a: Enter b: Enter c: : b: 5 6 1 x1: -0.2 X2: -1.0

import math a=int(input(Enter a: )) b=int(input(Enter b: )) c=int(input(Enter c: )) x1=(-b-math.sqrt(b**2-4*a*c))/(2*a)

import math

a=int(input("Enter a: "))
b=int(input("Enter b: "))
c=int(input("Enter c: "))

x1=(-b+math.sqrt(b**2-4*a*c))/(2*a)
x2=(-b-math.sqrt(b**2-4*a*c))/(2*a)

print("x1:",x1)
print("x2:",x2)

Add a comment
Know the answer?
Add Answer to:
1 a - int(input("Enter a: ")) 2 b - int(input("Enter b: ")) 3 C = int(input("Enter...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I have this code for python: num = int(input()) if num == 0: print('No change') else:...

    I have this code for python: num = int(input()) if num == 0: print('No change') else: dol = num // 100 num %= 100 Quarters = num // 25 num %= 25 Dimes = num // 10 num %= 10 Nickels = num // 5 num %= 5 Pennies = num if dol > 0: if dol == 1: print('1 Dollar') if Dollars > 1: print(dol,'Dollars') if Quarters > 0: if Quarters == 1: print('1 Quarter') if Quarters > 1:...

  • Python 3.7.3 If you type Ctrl-C while the shell is executing the input() function, a KeyboardInterrupt...

    Python 3.7.3 If you type Ctrl-C while the shell is executing the input() function, a KeyboardInterrupt exception will be raised. For example: >>> x = input() Traceback (most recent call last): File "<pyshell#0>", line 1, in <module>     x = input() KeyboardInterrupt >>> Create a wrapper function safe_input() which works just like the function input() except that it returns nothing when an exception is raised. >>> x = safe_input()    # Typing Ctrl-C >>> x                   # x is None >>> x...

  • Hi, can someone offer input on how to address these 4 remain parts the zybook python...

    Hi, can someone offer input on how to address these 4 remain parts the zybook python questions?   4: Tests that get_num_items_in_cart() returns 6 (ShoppingCart) Your output ADD ITEM TO CART Enter the item name: Traceback (most recent call last): File "zyLabsUnitTestRunner.py", line 10, in <module> passed = test_passed(test_passed_output_file) File "/home/runner/local/submission/unit_test_student_code/zyLabsUnitTest.py", line 8, in test_passed cart.add_item(item1) File "/home/runner/local/submission/unit_test_student_code/main.py", line 30, in add_item item_name = str(input('Enter the item name:\n')) EOFError: EOF when reading a line 5: Test that get_cost_of_cart() returns 10 (ShoppingCart)...

  • Need some explanation on what im doing wrong.? solved it, forgot to add strings # Get...

    Need some explanation on what im doing wrong.? solved it, forgot to add strings # Get N from the command line import sys N = int(sys.argv[1]) # Your code goes here if N == 100: print (Hit) else: print(Miss) use Conditions explained 2.5. Challenge == We will provide you with a number, N. . If N is equal to 100, output 'Hit' • otherwise, output 'Miss Remember that strings are case-sensitive! Check it! LAST RUN on 5/8/2020, 10:44:31 PM Program...

  • i have no lean break. so below is my way. can you fix it. Test Input...

    i have no lean break. so below is my way. can you fix it. Test Input Result print (read_number_list()) 999 [] print (read_number_list)) 1 Answer (penalty regime: 0, 10, 20, 30, 40, 50%) 1 def read_number_list(): alist = [] while True: - numberinput("") if number -999: 4 return a listl else: a_list.append (int (number)) 9 1e 12 Precheck Check Test Input Expected Got print (read_number_list()) 999 [] Runtime error** Traceback (most recent call last): File "prog.python3", line 29, in <module>...

  • Code is wrong: python parsing warm up. while(True): inp_str = input('Enter input string: ') if (inp_str...

    Code is wrong: python parsing warm up. while(True): inp_str = input('Enter input string: ') if (inp_str == 'q'): break; while inp_str.find(",")==-1: print('Error: No comma in string. ') inp_str=input('Enter input string: ')       s=inp_str.split(",") print('First word:'+ s[0].strip()) print('Second word:'+ s[1].strip()) print('\n') This is my code for a problem but the output is wrong and I dont know how to fix it (the top is the output im getting the bottom is what i am supposed to get) Enter input string:...

  • PYTHON, what am i doing wrong here jupyter fibo.pyv a few seconds ago File Edit View...

    PYTHON, what am i doing wrong here jupyter fibo.pyv a few seconds ago File Edit View Language 1 def add(n): 2 return n+2 In [546]: import fibo as fib k = fib.add(2) AttributeError Traceback (most recent call last) <ipython-input-546-5d91eeb591d2> in <module> 1 import fibo as fib ----> 2 k = fib.add(2) AttributeError: module 'fibo' has no attribute 'add

  • Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int...

    Programming language C Please go through this carefully. Needs function void add(int *a1, int n, int *a2) Write a program addition.c that reads in an array (a1) of numbers, and creates a new array (a2) of numbers such that the first and last numbers of a1 are added and stored as the first number, the second and second-to-last numbers are added and stored as the second number, and so on. You need to check for even and odd length of...

  • c++ program Create a file sales.cpp. to: ·Write a function int lastNeg(vector<float> diffs)to return the index...

    c++ program Create a file sales.cpp. to: ·Write a function int lastNeg(vector<float> diffs)to return the index of the last negative value in the vector. Return -1 if there are no negative values. ·Write main() to ask the user to enter sales numbers ·Starting with the 2nd value, compute the difference from the previous value and store this difference into a vector<float> ·Call lastNeg() to see when the most recent drop occurred ·Output when the last drop in sales occurred, or...

  • Please Help with the code below not sure where my error is...Thanks. Program output displayed here:...

    Please Help with the code below not sure where my error is...Thanks. Program output displayed here: Davy's auto shop services Oil change -- $35 Tire rotation -- $19 Car wash -- $7 Car wax -- $12 Enter the first service from the menu: Traceback (most recent call last): File "main.py", line 9, in choice1 = input("Enter the first service from the menu: "); EOFError: EOF when reading a line Here is the code: # Type your code here services =...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT