Question: Exercise 6 . 3 . 6 Last Names = = = = = = = = = = = = = = = = =
Exercise Last Names
In this exercise, you will start with the following list of names:
names
"Maya Angelou",
"Chimamanda Ngozi Adichie",
"Tobias Wolff",
"Sherman Alexie",
"Aziz Ansari"
Use a list comprehension to print a list of just the last names.
Hint: You can use an index not only on a list variable, but also on an expression that returns a list!
So if x has a method called listmethod that returns a list, you can get the th thing in the resulting list like this:
xlistmethod
Hint #: You'll need to use the split method!
Last names are the last part of the name.
names Maya Angelou","Chimamanda Ngozi Adichie","Tobias Wolff","Sherman Alexie","Aziz Ansari"
# Your code here...
def splitnamelistsalist:
return
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
