• BarryZ

@cvp Thanks! You have already helped me a lot! I will search it on the internet to figure it out.

• BarryZ

@cvp Besides, when I code like this:
def qfx(self,y,a,b,c):
delta=b2-4a(c-y)
if delta==0:
x=-b/2a
print('the x is',x)
if delta<0:
print('there is no solution for x.')
else:
x1=x=(-b+delta
(1/2))/(2a)
x2=x=(-b-delta**(1/2))/(2*a)
print('x1 is',x1)
print('x2 is',x2)

When I run it on my Mac and pythonista3:

q.qfx(1,4,8,10)
there is no solution for x.

It works.

Or when I code like this:
def qfx(y,a,b,c):
delta=b2-4a(c-y)
if delta==0:
x=-b/2a
print('the x is',x)
if delta<0:
print('there is no solution for x.')
else:
x1=x=(-b+delta
(1/2))/(2a)
x2=x=(-b-delta**(1/2))/(2*a)
print('x1 is',x1)
print('x2 is',x2)

When I run it on my Mac and pythonista3:

q.qfx(1,4,8,10)
there is no solution for x

It works.

• BarryZ

@cvp There is no @staticmethod.

On my Mac:

def QFY(x,a,b,c):
y=ax2+bx+c
print('the y is',y)

Run on my Mac:

Q.QFY(1,4,8,10)
the y is 22

• BarryZ

@cvp Thanks!

• BarryZ

@dgelessus Thanks for your suggestions. yeah, I am sure. On my Mac, I use python 3.7.x to code. I don’t know why.

• BarryZ

@cvp Thanks! It works! I am a beginner of python. Could you tell me why there must be self? When I code on my Mac, it could run without self, but when I code in pythonista3 on my phone, it must run with writing self.why? Look forward to your replying.

• BarryZ

The problem is when I code on my Mac, the codes can run. However, when I use the same code script in the pythonista 3, it can not run, which said that something takes n positional arguments, but n+1 were given.
I don not know whether this is the bug in pythonista3 or not?

``````def QFY(x,a,b,c):
y=a*x**2+b*x+c
print('the y is',y)

def QFX(y,a,b,c):
delta=b**2-4*a*(c-y)
if delta<0:
print('the function does not exist.')
if delta==0:
x=-b/2
print('the x is',x)
else:
x1=x=(-b+(delta**(1/2)))/(2*a)
x2=x=(-b-(delta**(1/2)))/(2*a)
print('x1 is',x1)
print('x2 is',x2)

def QFA(x,y,b,c):
if x==0:
print('the function is a line:')
else:
a=(y-b*x-c)/x**2
print('the a is',a)

def QFB(x,y,a,c):
if x==0:
print('the function is a line:')
else:
b=(y-a*x**2-c)/x
print('the b is',b)

def QFC(x,y,a,b):
c=y-a*x**2-b*x
print('the c is',c)
``````

When I ran this code in pythonista3, I received the following sentences: