from os import system
def a(len1,hgt=len1,til,col=0):
system(\'mode con cols=\'+len1,\'lines=\'+hgt)
system(\'title\',til)
system(\'color\',col)
a(64,25
You can't have a non-keyword argument after a keyword argument.
Make sure you re-arrange your function arguments like so:
def a(len1,til,hgt=len1,col=0):
system('mode con cols='+len1,'lines='+hgt)
system('title',til)
system('color',col)
a(64,"hi",25,"0b")
As the error message says, non-default argument til should not follow default argument hgt.
Changing order of parameters (function call also be adjusted accordingly) or making hgt non-default parameter will solve your problem.
def a(len1, hgt=len1, til, col=0):
->
def a(len1, hgt, til, col=0):
UPDATE
Another issue that is hidden by the SyntaxError.
os.system accepts only one string parameter.
def a(len1, hgt, til, col=0):
system('mode con cols=%s lines=%s' % (len1, hgt))
system('title %s' % til)
system('color %s' % col)
Let me clarify two points here :
(a = 'b',c) in function.
The correct order of defining parameter in function are :(a,b,c)(a = 'b',r= 'j')(*args)(**kwargs)def example(a, b, c=None, r="w" , d=[], *ae, **ab):
(a,b) are positional parameter
(c=none) is optional parameter
(r="w") is keyword parameter
(d=[]) is list parameter
(*ae) is keyword-only
(*ab) is var-keyword parameter
so first re-arrange your parameters
so second remove this "len1 = hgt" it's not allowed in python.
keep in mind the difference between argument and parameters.