Learning starts with a question
First time here? Checkout the FAQs!
x

*Math Image Search only works best with zoomed in and well cropped math screenshots. Check DEMO


MathsGee Android Q&A

0 like 0 dislike
175 views
What does the **kwargs do in Python?
in Data Science & Statistics by SIlver Status (11,342 points) | 175 views

1 Answer

0 like 0 dislike
Best answer

We can also use the **kwargs syntax in a Python function declaration. It let us pass N (variable) number of arguments which can be named or keyworded.

Example of using the **kwargs:

# Python code to demonstrate 
# **kwargs for dynamic + named arguments 
def fn(**kwargs):  
    for emp, age in kwargs.items(): 
        print ("%s's age is %s." %(emp, age)) 
    
fn(John=25, Kalley=22, Tom=32)

The output:

John's age is 25.
Kalley's age is 22.
Tom's age is 32.

 

by SIlver Status (11,342 points)

Related questions

0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 180 views
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 171 views
1 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 175 views
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 182 views
1 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 184 views
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 182 views
0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 160 views
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 156 views
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 130 views
0 like 0 dislike
0 answers
0 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 163 views
1 like 0 dislike
1 answer
asked Jun 26, 2020 in Data Science & Statistics by Student SIlver Status (11,342 points) | 207 views

Join MathsGee, where you get quality STEM education support from our community of verified experts fast.


On the MathsGee, you can:


1. Ask questions


2. Get expert answers


3. Vote on questions and answers


4. Tip your favorite community members


5. Join expert live video sessions (Paid/Free)


6. Earn points by participating



Posting on MathsGee


1. Remember the human


2. Act like you would in real life


3. Find original source of content


4. Check for duplicates before publishing


5. Read the community guidelines




MathsGee Rules


1. Answers to questions will be posted immediately after moderation


2. Questions will be queued for posting immediately after moderation


3. Depending on the number of messages we receive, you could wait up to 24 hours for your message to appear. But be patient as posts will appear after passing our moderation.




MathsGee Android Q&A

MathsGee Android Q&A