[Tutor] (no subject)
Alan Gauld
alan.gauld at yahoo.co.uk
Sat Feb 27 06:31:36 EST 2021
On 27/02/2021 07:09, ੧ wrote:
> I tried -
>
>
> def mufunc(**kwargs):
> finaloutput = '' "
> i = 0
> while i < len(kwargs):
> if i%2 == 0:
> finaloutput = finaloutput + kwargs[i].upper()
> else:
> finaloutput = finaloutput + kwargs[i].lower()
> i = i + 1
>
> return finaloutput
>
> myfunc('Anthropomorphism')
>
>
> It's not working. Please guide me.
"Its not working" is not very helpful, please tell us what
doesn't work. In particular send us any error messages(in full)
that you get as they contain lots of useful information.
In this case the problem lies in the line:
finaloutput = '' "
Your quotes do not match so python doesn't know what it means.
You should get a syntax error message highlighting that line.
You have another problem in that your function
is called mufunc() rather than myfunc() These details
are trivial for humans but critically important
for computers.
More importantly you say you want **kwargs as a parameter.
I suspect you copied that from somewhere and don't
understand what it means. Just remove the ** from
kwargs with for now.
Finally, you need to print the result of your
function call to see the result.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list