Print options

I am trying to understand the difference in the output of two print functions, and the question I have is, can I print the second example across rather than the way it is currently presented (i.e., down)?

example 1:
def student_details(name, age, class_level):
print(name, age, class_level)

student_details(“Jim”, 16, 10)

#output is:
Jim 16 10

example 2:

def user_details(**kwargs):
for key, value in kwargs.items():
print(f"{key}:{value}")

user_details(name=“Lisa”, age = 25, gender = “Female”)

#Output is:
name:Lisa
age:25
gender:Female

You could use the end keyword argument for the print function [to print multiple iterations on one line].
I used end=", " to do so.

def user_details(**kwargs): for key, value in kwargs.items(): print(f"{key}:{value}", end=", ") print() user_details(name="Lisa", age=25, gender="Female")

I’m having trouble with these codes too! But I’m gradually finding the answers))) I test it myself and also ask questions when something doesn’t work out for a long time!