Odoo Help
Odoo is the world's easiest all-in-one management software. It includes hundreds of business apps:
CRM
|
e-Commerce
|
Accounting
|
Inventory
|
PoS
|
Project management
|
MRP
|
etc.
ValueError: too many values to unpack (expected 3)? [Closed]
The Question has been closed for reason: off-topic or not relevant
byI 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
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.
RegisterOdoo Training Center
Access to our E-learning platform and experience all Odoo Apps through learning videos, exercises and Quizz.
Test it nowQuestion tools
Stats
Asked: 11/19/13, 2:36 PM |
Seen: 2977 times |
Last updated: 3/16/15, 8:10 AM |
Is this something related to OpenERP?
I don't know what that is........ I'm doing this for class trying to figure out quadratic equations through python
This is not the right place to ask for code that is not related to OpenERP, you can try on Stackoverflow