python - Syntax error on def -
from tkinter import * class nodo: def __init__(self,x,y=none): self.valor=x self.sgte=y class cola (nodo): def __init__(self,n): self.capa=n self.prim=none self.ulti=none def vacio(self): if self.prim==none: return true return false def lleno(self): a=self.prim b=0 while a!=none: a=a.sgte b=b+1 if b==self.capa: return true else: return false def existe (self,x): a=self.prim while a!= none: if a.valor== x: return true a=a.sgte return false def poner (self,x): nodo=nodo(x,none) if x.isalpha()==true or x.isdigit()==true: if self.lleno() == true: raise colallena() if self.existe()==true: raise yaexiste() if self.vacio() ==true: self.prim=nodo self.ulti=nodo if self.vacio()==false: self.ulti.sgte=nodo def sacar (self,x): if self.empty()==true: raise colavacia() a=self.prim.valor if self.prim.sgte !=none: self.prim=self.prim.sgte return def str(self,x): if self.vacio()==true: return "" else: a=self.prim l=[] while a!=none: l.append(a.valor) a=a.sgte l="" in l: i=str(i) l=l+" "+i return l class colallena (exception): def __init__(self): pass class yaexiste (exception): def __init__(self): pass class colavacia (exception): def __init__(self): pass c1=cola(10) c2=cola(20) def atender1(): if c1.empty()== true: r1.delete(0,end) r1.insert(0,"cola vacia") else: a=c1.sacar() r1.config(text=("atendiendo a:"+str(a)) def atender2(): if c2.empty() == true: r2.delete(0,end) r2.insert(0,"cola vacia") else: a=c2.sacar() r2.config(text=("atendiendo a:"+str(a))
i have syntax error in def atender (x)
, in def
, don't know why, check code , still can't find problem , please :c
the line before missing closing parenthesis:
r1.config(text=("atendiendo a:"+str(a)) # ----^ --^ ---^ ^^
you have 3 opening parenthesis, closing 2. second opening parenthesis can dropped:
r1.config(text="atendiendo a:" + str(a))
you have same problem few lines down:
r2.config(text=("atendiendo a:"+str(a)) # ----^ --^ ---^ ^^
Comments
Post a Comment