I’m trying to write a program that can take and print a variable number of arguments. The code is below. My code works, however, the format of the output is not what I am trying to achieve. Can someone help me work around the output?
Desired output:
JavaScript
x
2
1
{'first': 'Steve', 'last': 'Cook'}
2
My output:
JavaScript
1
4
1
first:Steve
2
3
last:Cook
4
JavaScript
1
9
1
def full_name(**data):
2
for key, value in data.items():
3
print(f"{key}:{value}")
4
5
first = input()
6
last = input()
7
8
full_name(first = first, last = last)
9
Advertisement
Answer
I apparently went too far I guess? This is the proper coding, thanks everyone for the help.
JavaScript
1
8
1
def full_name(**data):
2
print(data)
3
4
first = input()
5
last = input()
6
7
full_name(first = first, last = last)
8