logo-MindMajix
PostPythonPython
T
Tom 234

Posted on 24th July 2024|49 views

0
votes

Python Optional Arguments

How to create a python function with optional arguments?

1 answers
Answers
P
Tim Parker

Posted on 24th July 2024| views

We can utilise the parameter of *args, that permits you to transfer as many arguments as you need. For example:

 

def myfunc(u,v, *args, **kwargs): 

for ar in args: 

print ar 

myfunc(u,v,w,x,y,z)

 

Write your answer

STILL GOT QUERIES?

Get a Live FREE Demo

  • Explore the trending and niche courses and learning maps
  • Learn about tuition fee, payment plans, and scholarships
  • Get access to webinars and self-paced learning videos
Name
Course *
Email *
Phone Number