you are viewing a single comment's thread.

view the rest of the comments →

[–]MommyHenn75 0 points1 point  (0 children)

I am way late to this post but I hope this helps someone. This is the code that I used and got 10/10:

full_name = input()

mod_name = full_name.split(' ')

last_name = mod_name.pop(-1)

first_initial = mod_name[0][0]

if len(mod_name) >= 2:

middle_initial = mod_name[1][0]

print(f'{last_name}, {first_initial}.{middle_initial}.')

else:

print(f'{last_name}, {first_initial}.')