Odoo Help

Welcome!

This community is for beginners and experts willing to share their Odoo knowledge. It's not a forum to discuss ideas, but a knowledge base of questions and their answers.

-1

ValueError: too many values to unpack (expected 3)? [Closed]

By
nick crochet
on 11/19/13, 2:36 PM 2,126 views

The Question has been closed for reason: off-topic or not relevant

by
Grover Menacho
on 11/19/2013 17:52:04
I am asking for input from a data file that only has 3 numbers and its saying theres too many to unpack... I already checked for whitespace and extra lines or whatever...

CODE:

    import math

    class QuadEq:

        def __init__(self, x, y, z):
                self.__a = x
            self.__b = y
            self.__c = z
        def GetCoeff(self):
            self.__a, self.__b, self.__c = input()
            return self.__a, self.__b, self.__c
        def checkRoots(self):
            if (self.__b**2 - (4 * self.__a * self.__b)) == 0:
                amountOfRoots = "1 Root"
            elif (self.__b**2 - (4 * self.__a * self.__b)) > 0:
                amountOfRoots = "2 Roots"
            elif (self.__b**2 - (4 * self.__a * self.__b)) < 0:
                amountOfRoots = "No Real Roots"
            else: 
                amountOfRoots = "Error"
            return amountOfRoots
        def solveRoots(self):
            root1 = (-self.__b + math.sqrt(self.__b**2-(4*self.__a*self.__c)))/2*self.__a
            root2 = (-self.__b - math.sqrt(self.__b**2-(4*self.__a*self.__c)))/2*self.__a
            return root1, root2

    def main():
        QE = QuadEq(0,0,0)
        print(format("Coefficients", '>17'), format("# of Roots", '>16'), format("Roots", '>15'))
        print("=======================================================")
        QE.GetCoeff()
        QE.checkRoots()
        QE.solveRoots()
    main()


INPUT FILE:
1,-8,16


COMMAND TO EXECUTE:
python file.py <file.data

Is this something related to OpenERP?

GH Mediacloud, Grover Menacho
on 11/19/13, 4:15 PM

I don't know what that is........ I'm doing this for class trying to figure out quadratic equations through python

nick crochet
on 11/19/13, 5:08 PM

This is not the right place to ask for code that is not related to OpenERP, you can try on Stackoverflow

GH Mediacloud, Grover Menacho
on 11/19/13, 5:50 PM

About This Community

This community is for professionals and enthusiasts of our products and services. Read Guidelines

Question tools

0 follower(s)

Stats

Asked: 11/19/13, 2:36 PM
Seen: 2126 times
Last updated: 3/16/15, 8:10 AM