Odoo Help


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

nick crochet
on 11/19/13, 2:36 PM 1,353 views

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

Grover Menacho
on 11/19/2013 17:52:16

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...


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"
        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< p="">

About This Community

This platform 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.


Odoo Training Center

Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.

Test it now

Question tools

0 follower(s)


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