Knowee
Questions
Features
Study Tools

What is the output of the following display() function calldef display(**kwargs):    for i in kwargs:        print(i)display(emp="Kelly", salary=9000)

Question

What is the output of the following display() function call?


def display(**kwargs):
    for i in kwargs:
        print(i)

display(emp="Kelly", salary=9000)
🧐 Not the exact question you are looking for?Go ask a question

Solution

The output of the given function call will be:

emp salary

Explanation: The function display() is defined with **kwargs as a parameter, which allows it to accept any number of keyword arguments. In the function body, a for loop is used to iterate over these keyword arguments. The variable 'i' will take on the key of each keyword argument.

When the function is called with the keyword arguments emp="Kelly" and salary=9000, the for loop will first iterate over the key 'emp', and then 'salary'. These keys are then printed out, resulting in the output above.

This problem has been solved

Similar Questions

Which method is used for display output in Python?Question 7Answerinput()print()All choices are correct.output()

3.Question 3What does the following code display?device_id = "Tj1C58Dakx"print(device_id.lower())1 point"tj1c58dakx""Tj1C58Dakx""TJ1C58DAKX""tj1C58Dakx"

What is the output of the following code snippet?exp = lambda x: x % 3print(exp(2))

What is the output of the following function calldef fun1(name, age=20):    print(name, age) fun1('Emma', 25)Emma 25Emma 20Emma 22

What is the output of the following code?#include <stdio.h>int main() {    int i = 0;    for (; i < 5; i++);    printf("%d ", i);    return 0;}

1/1

Upgrade your grade with Knowee

Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.