How JustAnswer Works:

  • Ask an Expert
    Experts are full of valuable knowledge and are ready to help with any question. Credentials confirmed by a Fortune 500 verification firm.
  • Get a Professional Answer
    Via email, text message, or notification as you wait on our site.
    Ask follow up questions if you need to.
  • 100% Satisfaction Guarantee
    Rate the answer you receive.

Ask R.R. Jha Your Own Question

R.R. Jha
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience:  B.Tech
Type Your Homework Question Here...
R.R. Jha is online now
A new question is answered every 9 seconds

Help my homework please!!!Im using Python 2.7.3Write

This answer was rated:

Help my homework please!!! I'm using Python 2.7.3 Write a program to solve Ax^2 + Bx + C = 0 where A, B, and C can be any real number and x can be complex (x = a + bi). Note: A, B, and/or C can be zero so you must consider ALL possibilities for the coefficients. General Instructions: In all that follows replace 999 with your assigned classid and $ represents the Unix command prompt. create a directory named mp1id999 and cd into it and create four files:,, abc.txt (to test your program), and README. Your program will consist of two modules (i.e. two .py files). - The module will contain the main() function for your program and possibly a few helper functions if needed. - The module will contain the functions roots1(), roots2(), ... , roots6() and possibly a few helper functions if needed. The function main() will contain four variables named a,b,c and d for the 3 three coefficients and the discriminant. You must open two files: abc.txt for reading only and output.txt for writing only. Each row of abc.txt will contain 3 real numbers for the coefficients a, b and c. The files should be closed with close() before terminating the program. In reading abc.txt, assume that each number in the file can begin/end with any kind of whitespace like tabs, spaces and newline characters. In addition assume that there might be lines of white space at the end of the file. You should test for these so they do not crash your program. Input and process each set of coefficients in the file. -There are six different cases that that need to be considered. Three for a equal to zero and three for a not zero. Use an if-elif structure to determine the case and call one of 6 functions named roots1(), roots2(), ... , roots6() with no return value. - The variables a, b, c, d should be passed to each of the functions along with the output file stream that you opened. - The functions, roots1(), through roots6(), should be called to calculate the roots and print the results to the file named roots999.txt. The output should be similar to the sample output below. - In addition, include a heading at the top of the output file. The 1 of 4heading should be very simple with a border around it. Use a function call to print your heading. It should have the following form: Your Name UID MCS260, Spring 2013 mp1id999 Your program should never take the square root of a negative number or divide by zero. Otherwise, points will be deducted from your program score even if the program works. Some computers will crash if you do (Windows 98). When possible, you should always write your programs so they work on other computers. README will contain very simple instructions and information that would be useful to someone using your program. However, your README file will not change the way your program is tested. All programs will be run and tested the same way. In the if-elif structure the last else should result in printing an error message. ( i.e. "ERROR: Never get here!" message ). This is considered good programming. Your source code must be formatted using a style similar to that in the textbook or class examples and the first few lines of the file must begin with a comment giving the complete file name, information about you and what is in the file. Include a doc-string for each module and each function definition. For example >>> import quadroots followed by >>> help(quadroots) should provide useful information about the module and each of the functions in it. Make sure you test your code for all possible types of input values. You can check your answers using a calculator or a program like Maple, Matlab (available in pc-labs) or Octave (on raphael or icarus). Sample input: from file abc.txt (Yours will most likely be different than this) 0 0 0 0 0 1 0 2 4 1 2 1 1 5 6 1.1 2.2 3.3 -3.14159 2.71828 1.414 --------Sample output in file named roots999.txt:------------- ===================== ==Your very nice heading here. == ===================== 0.0*x^2 + 0.0*x + 0.0 = 0 has as an infinity of roots: all complex numbers are roots ===================================================== 0.0*x^2 + 0.0*x + 1.0 = 0 has no roots ===================================================== 0.0*x^2 + 2.0*x + 4.0 = 0 has one root: x = -2.0 ===================================================== 1.0*x^2 + 2.0*x + 1.0 = 0, d = 0.0000 has a double root: x = -1.0 ===================================================== 1.0*x^2 + 5.0*x + 6.0 = 0, d = 1.0000 has two real roots: x1 = -2.0 x2 = -3.0 ===================================================== 1.1*x^2 + 2.2*x + 3.3 = 0, d = -9.6800 has two complex roots: x1 = -1.0 + i*1.4142 x2 = -1.0 - i*1.4142 ===================================================== -3.1416*x^2 + 2.7183*x + 1.4140 = 0, d = 25.1579 has two real roots: x1 = -0.3657 x2 = 1.2309 =====================================================


I'd be glad to help. Please upload on your original question document and the codes you've so far.

Customer: replied 3 years ago.

I don't have any codes :(


The following is the original question document.


Received it. What's the deadline?
Customer: replied 3 years ago.


How long do you think it will take to get the homework done?

I can have it ready by tomorrow.
Customer: replied 3 years ago.

The homework is due tomorrow. Thank you so much.

you're welcome
Customer: replied 3 years ago.

How are you coming, sir?


Working through, would post it by sometime tonight.
Customer: replied 3 years ago.



Have completed most of it. I'll finish the rest and post your answer in about an hour.

You need to spend $3 to view this post. Add Funds to your account and buy credits.
R.R. Jha, Tutor
Category: Homework
Satisfied Customers: 5471
Experience: B.Tech
R.R. Jha and 8 other Homework Specialists are ready to help you

JustAnswer in the News:

Ask-a-doc Web sites: If you've got a quick question, you can try to get an answer from sites that say they have various specialists on hand to give quick answers... seen a spike since October in legal questions from readers about layoffs, unemployment and severance.
Web sites like
...leave nothing to chance.
Traffic on JustAnswer rose 14 percent...and had nearly 400,000 page views in 30 days...inquiries related to stress, high blood pressure, drinking and heart pain jumped 33 percent.
Tory Johnson, GMA Workplace Contributor, discusses work-from-home jobs, such as JustAnswer in which verified Experts answer people’s questions.
I will tell you that...the things you have to go through to be an Expert are quite rigorous.

What Customers are Saying:

  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
< Previous | Next >
  • Wonderful service, prompt, efficient, and accurate. Couldn't have asked for more. I cannot thank you enough for your help. Mary C. Freshfield, Liverpool, UK
  • This expert is wonderful. They truly know what they are talking about, and they actually care about you. They really helped put my nerves at ease. Thank you so much!!!! Alex Los Angeles, CA
  • Thank you for all your help. It is nice to know that this service is here for people like myself, who need answers fast and are not sure who to consult. GP Hesperia, CA
  • I couldn't be more satisfied! This is the site I will always come to when I need a second opinion. Justin Kernersville, NC
  • Just let me say that this encounter has been entirely professional and most helpful. I liked that I could ask additional questions and get answered in a very short turn around. Esther Woodstock, NY
  • Thank you so much for taking your time and knowledge to support my concerns. Not only did you answer my questions, you even took it a step further with replying with more pertinent information I needed to know. Robin Elkton, Maryland
  • He answered my question promptly and gave me accurate, detailed information. If all of your experts are half as good, you have a great thing going here. Diane Dallas, TX

Meet The Experts:

  • LogicPro



    Satisfied Customers:

    Expert in Java C++ C C# VB Javascript Design SQL HTML
< Last | Next >
  • LogicPro's Avatar



    Satisfied Customers:

    Expert in Java C++ C C# VB Javascript Design SQL HTML
  • Manal Elkhoshkhany's Avatar

    Manal Elkhoshkhany


    Satisfied Customers:

    More than 5000 online tutoring sessions.
  • Linda_us's Avatar


    Finance, Accounts & Homework Tutor

    Satisfied Customers:

    Post Graduate Diploma in Management (MBA)
  • Chris M.'s Avatar

    Chris M.

    M.S.W. Social Work

    Satisfied Customers:

    Master's Degree, strong math and writing skills, experience in one-on-one tutoring (college English)
  • F. Naz's Avatar

    F. Naz

    Chartered Accountant

    Satisfied Customers:

    Experience with chartered accountancy
  • Bizhelp's Avatar



    Satisfied Customers:

    Bachelors Degree and CPA with Accounting work experience
  • Seanna's Avatar



    Satisfied Customers:

    3,000+ satisfied customers, all topics, A+ work

Related Homework Questions