Code :
Solution and Explanation:
Function Definition:
def fun(a, *args, s='!'):
The function fun is defined to take at least one argument a, followed by any number of additional positional arguments (*args), and an optional keyword argument s with a default value of '!'.
Print the First Argument and Suffix:
print(a, s)
This line prints the value of the first argument a followed by the value of the keyword argument s.
Loop through Additional Arguments:
for i in args:
print(i, s)
This loop iterates through any additional positional arguments provided (if any) and prints each one followed by the value of the keyword argument s.
Function Call:
fun(10)
The function is called with the argument 10. Since no additional positional arguments are provided, only the first print statement is executed.
When you run this code, it will output:
10 !
0 Comments:
Post a Comment