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,"hi","0b")
input()
When I run this, it rejects "def a(..." and highlights "(" in red. I have no clue why.
As the error message says, non-default argument
til
should not follow default argumenthgt
.Changing order of parameters (function call also be adjusted accordingly) or making
hgt
non-default parameter will solve your problem.->
UPDATE
Another issue that is hidden by the SyntaxError.
os.system
accepts only one string parameter.Let me clear two points here :
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
(*e) is keyword-only
(*opts) is var-keyword parameter
so first re-arrange your parameters
so second remove this "len1=hgt" its not allowed in python.
keep in mind difference between argument and parameters , you can read more about here : Arguments and parameters in python
You can't have a non-keyword argument after a keyword argument.
Make sure you re-arrange your function arguments like so: