Python-how can I call the function with keyword arguments? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Python-how can I call the function with keyword arguments?

Exercise #1 Create a function show_employee() in such a way that it should accept employee name, and its salary and display both. If the salary is missing in the function call assign default value 50000 to salary. Call this function 3 times: with keyword arguments with 2 positional arguments with 1 positional argument You can use any values for arguments. As a result, you should have the function definition and 3 function calls. def show_employee(name, salary=50000): print("Employee", name, "salary is:", salary) show_employee("Ben", 50000) show_employee("Ben")

18th Apr 2021, 7:16 PM
Elisa
1 Answer
+ 1
hi Natalia Staver - your print statement needs to be indented. example below: def show_employee(name, salary=50000): print(“something”) as a reminder, indentations are very important in python.
18th Apr 2021, 7:44 PM
you are smart. you are brave.
you are smart. you are brave. - avatar