def myfunc (*args, **kwargs):
print (args)
print (kwargs)
print (f'I would like {args[0]} {kwargs['food']}')
#Example #2 print ('I would like {} {}'.format(args[0], kwargs['food']))
myfunc(10,20,30,fruit = 'orange', food = 'eggs', animal = 'dog')
When I execute the code above, I get an error that says:
SyntaxError: f-string: unmatched '['
However, when I execute "Example #2" instead, I get the correct output:
I would like 10 eggs
What is wrong with my syntax when using f-string literal?