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.

0

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

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

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

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

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

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: 732 times
Last updated: 3/16/15, 8:10 AM