def myfunc(*args, **kwargs):
if ‘fruit’ and ‘juice’ in kwargs:
print(f”I like {‘ and ‘.join(args)} and my favorite fruit is {kwargs[‘fruit’]}”)
print(f”May I have some {kwargs[‘juice’]} juice?”)
else:
pass
myfunc(‘eggs’,’spam’,fruit=’cherries’,juice=’orange’)
I want to change from f() to .format(). How can i do that
New contributor
Ngọc Yến is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.