Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
The name is "asha rao". Show its initials in capital letters: AR.
split() makes a list of words. Two positions in a row pick a letter out of a word.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
Plan. Split the name into words, take the first letter of each word, join them and use capital letters.
parts = name.split() gives the list ["asha", "rao"].parts[0][0] is a, the first letter of the first word. parts[1][0] is r.initials = parts[0][0] + parts[1][0] is "ar".initials.upper() is AR.Log in to join the discussion.
Loading…