Question: I need to create a python 3 code that will return the initials of the first and last names in capitalized letters with ' '
I need to create a python 3 code that will return the initials of the first and last names in capitalized letters with ' ' . e.g. john doe = 'JD'.
***** I WOULD LIKE TO SEE HOW A CORRECT CODE WOULD RUN WITH A LIST TO SOLVE THIS PROBLEM.****
Required first line of code: def get_initials(fullname):
MY FIRST TRY:
def get_initials(fullname):
def main(): fullname = ("Type your name here.")
name_list = fullname.split()
for part in name_list: print(part[0].upper() + "", end="")
print ()
THE FOLLOWING IS THE RESULT OF MY SUBMISSION:
Your code failed the following tests: -------------------------------------
For get_initials('bonnie blair') You should have returned this: 'BB' ***But you actually returned this: None
For get_initials('Ozzie smith') You should have returned this: 'OS' ***But you actually returned this: None
For get_initials('Daniel Day Lewis') You should have returned this: 'DDL' ***But you actually returned this: None
For get_initials('HULK') You should have returned this: 'H' ***But you actually returned this: None
For get_initials('Ada Lovelace') You should have returned this: 'AL' ***But you actually returned this: None
For get_initials('Jar Jar Binks') You should have returned this: 'JJB' ***But you actually returned this: None
BB
OS
DDL
H
AL
JJB
I appreciate the help, Thanks!
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
