I am having difficulty writing this program, I can create a functional program, however it marks it as wrong because it does not utilize a list comprehension. Any suggestions for how to properly utilize a list comprehension for this exercise and write a program in 2 lines or less (excluding the list of names)? Thank you.
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 list_method that returns a list, you can get the 0th thing in the resulting list like this:
... x.list_method()[0] ...
Hint #2: You’ll need to use the split method!
Answers
Answered by
2
Answer:
Abe itta bda question o v 5 points ka .....nii btata mai
Similar questions